Skip to content

Commit

Permalink
Merge pull request #498 from ydah/add-rbs-inline-style-type2
Browse files Browse the repository at this point in the history
Add RBS type signatures for Logger and generate RBS file
  • Loading branch information
ydah authored Jan 2, 2025
2 parents c4871ec + 223481e commit 52f0d37
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
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/trace_reporter.rb"
check "lib/lrama/warning.rb"
Expand Down
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

0 comments on commit 52f0d37

Please sign in to comment.