Skip to content

Commit

Permalink
Add RBS type signatures for Logger and generate RBS file
Browse files Browse the repository at this point in the history
  • Loading branch information
ydah committed Jan 1, 2025
1 parent 317b7d1 commit 223481e
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/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

0 comments on commit 223481e

Please sign in to comment.