Class: RBI::RBS::MethodTypeTranslator
- Inherits:
-
Object
- Object
- RBI::RBS::MethodTypeTranslator
- Defined in:
- lib/rbi/rbs/method_type_translator.rb
Defined Under Namespace
Classes: Error
Instance Attribute Summary collapse
-
#result ⇒ Object
readonly
: Sig.
Class Method Summary collapse
-
.translate(method, type) ⇒ Object
: (Method, ::RBS::MethodType) -> Sig.
Instance Method Summary collapse
-
#initialize(method) ⇒ MethodTypeTranslator
constructor
: (Method) -> void.
-
#visit(type) ⇒ Object
: (::RBS::MethodType) -> void.
Constructor Details
#initialize(method) ⇒ MethodTypeTranslator
: (Method) -> void
22 23 24 25 |
# File 'lib/rbi/rbs/method_type_translator.rb', line 22 def initialize(method) @method = method @result = Sig.new #: Sig end |
Instance Attribute Details
#result ⇒ Object (readonly)
: Sig
19 20 21 |
# File 'lib/rbi/rbs/method_type_translator.rb', line 19 def result @result end |
Class Method Details
.translate(method, type) ⇒ Object
: (Method, ::RBS::MethodType) -> Sig
11 12 13 14 15 |
# File 'lib/rbi/rbs/method_type_translator.rb', line 11 def translate(method, type) translator = new(method) translator.visit(type) translator.result end |
Instance Method Details
#visit(type) ⇒ Object
: (::RBS::MethodType) -> void
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/rbi/rbs/method_type_translator.rb', line 28 def visit(type) type.type_params.each do |param| result.type_params << param.name end visit_function_type(type.type) block = type.block visit_block_type(block) if block end |