Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RBS type signatures for Logger and generate RBS file #498

Merged
merged 1 commit into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Steepfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ target :lib do
check "lib/lrama/counterexamples.rb"
check "lib/lrama/digraph.rb"
check "lib/lrama/grammar.rb"
check "lib/lrama/logger.rb"
check "lib/lrama/options.rb"
check "lib/lrama/warning.rb"
end
4 changes: 4 additions & 0 deletions lib/lrama/logger.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
# rbs_inline: enabled
# frozen_string_literal: true

module Lrama
class Logger
# @rbs (IO out) -> void
def initialize(out = STDERR)
@out = out
end

# @rbs (String message) -> void
def warn(message)
@out << message << "\n"
end

# @rbs (String message) -> void
def error(message)
@out << message << "\n"
end
Expand Down
14 changes: 14 additions & 0 deletions sig/generated/lrama/logger.rbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Generated from lib/lrama/logger.rb with RBS::Inline

module Lrama
class Logger
# @rbs (IO out) -> void
def initialize: (IO out) -> void

# @rbs (String message) -> void
def warn: (String message) -> void

# @rbs (String message) -> void
def error: (String message) -> void
end
end
Loading