From 223481e43075ccf4252f645549b45b8329a4d2ac Mon Sep 17 00:00:00 2001 From: ydah Date: Wed, 1 Jan 2025 22:03:00 +0900 Subject: [PATCH] Add RBS type signatures for Logger and generate RBS file --- Steepfile | 1 + lib/lrama/logger.rb | 4 ++++ sig/generated/lrama/logger.rbs | 14 ++++++++++++++ 3 files changed, 19 insertions(+) create mode 100644 sig/generated/lrama/logger.rbs diff --git a/Steepfile b/Steepfile index 0c34556c..8e56d2b6 100644 --- a/Steepfile +++ b/Steepfile @@ -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 diff --git a/lib/lrama/logger.rb b/lib/lrama/logger.rb index e98eef0f..88bb9209 100644 --- a/lib/lrama/logger.rb +++ b/lib/lrama/logger.rb @@ -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 diff --git a/sig/generated/lrama/logger.rbs b/sig/generated/lrama/logger.rbs new file mode 100644 index 00000000..87f0787e --- /dev/null +++ b/sig/generated/lrama/logger.rbs @@ -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