Use create_module instead

This commit is contained in:
Douglas Eichelberger 2024-03-15 21:10:08 -07:00 committed by Issy Long
parent 05b716613b
commit 769547e7e3
No known key found for this signature in database
2 changed files with 3 additions and 3 deletions

View File

@ -4,7 +4,7 @@
# This is an autogenerated file for dynamic methods in `Tty`.
# Please instead update this file by running `bin/tapioca dsl Tty`.
module
module Tty
sig { returns(String) }
def blue; end

View File

@ -16,13 +16,13 @@ module Tapioca
sig { override.void }
def decorate
root.create_path(constant) do |klass|
root.create_module(constant.name) do |mod|
dynamic_methods = ::Tty::COLOR_CODES.keys + ::Tty::STYLE_CODES.keys + ::Tty::SPECIAL_CODES.keys
methods = ::Tty.methods(false).sort.select { |method| dynamic_methods.include?(method) }
methods.each do |method|
return_type = (method.to_s.end_with?("?") ? "T::Boolean" : "String")
klass.create_method(method.to_s, return_type:)
mod.create_method(method.to_s, return_type:)
end
end
end