Class: Yoda::Model::FunctionSignatures::RbsMethod
- Defined in:
- lib/yoda/model/function_signatures/rbs_method.rb
Instance Attribute Summary collapse
- #rbs_definition ⇒ RBS::Definition readonly
- #rbs_method_definition ⇒ RBS::Definition::Method readonly
- #rbs_method_typedef ⇒ RBS::Definition::Method::TypeDef readonly
Instance Method Summary collapse
- #document ⇒ String
-
#initialize(rbs_definition:, rbs_method_definition:, rbs_method_typedef:) ⇒ RbsMethod
constructor
A new instance of RbsMethod.
- #name ⇒ String
- #namespace_path ⇒ String
- #parameter_type_of(param) ⇒ TypeExpressions::Base? abstract
- #parameters ⇒ ParameterList abstract
- #rbs_type(_env) ⇒ RBS::MethodType
- #sep ⇒ Object
- #sources ⇒ Array<(String, Integer, Integer)>
- #tags ⇒ Array<Store::Objects::Tag>
- #to_s ⇒ String
- #type ⇒ TypeExpressions::FunctionType
- #visibility ⇒ Symbol
Methods inherited from Base
Constructor Details
#initialize(rbs_definition:, rbs_method_definition:, rbs_method_typedef:) ⇒ RbsMethod
Returns a new instance of RbsMethod.
17 18 19 20 21 |
# File 'lib/yoda/model/function_signatures/rbs_method.rb', line 17 def initialize(rbs_definition:, rbs_method_definition:, rbs_method_typedef:) @rbs_definition = rbs_definition @rbs_method_definition = rbs_method_definition @rbs_method_typedef = rbs_method_typedef end |
Instance Attribute Details
#rbs_definition ⇒ RBS::Definition (readonly)
6 7 8 |
# File 'lib/yoda/model/function_signatures/rbs_method.rb', line 6 def rbs_definition @rbs_definition end |
#rbs_method_definition ⇒ RBS::Definition::Method (readonly)
9 10 11 |
# File 'lib/yoda/model/function_signatures/rbs_method.rb', line 9 def rbs_method_definition @rbs_method_definition end |
#rbs_method_typedef ⇒ RBS::Definition::Method::TypeDef (readonly)
12 13 14 |
# File 'lib/yoda/model/function_signatures/rbs_method.rb', line 12 def rbs_method_typedef @rbs_method_typedef end |
Instance Method Details
#document ⇒ String
53 54 55 |
# File 'lib/yoda/model/function_signatures/rbs_method.rb', line 53 def document rbs_method_typedef.comment&.string || "" end |
#name ⇒ String
43 44 45 |
# File 'lib/yoda/model/function_signatures/rbs_method.rb', line 43 def name rbs_method_typedef.member.name.to_s end |
#namespace_path ⇒ String
48 49 50 |
# File 'lib/yoda/model/function_signatures/rbs_method.rb', line 48 def namespace_path rbs_definition.type_name.to_s end |
#parameter_type_of(param) ⇒ TypeExpressions::Base?
This method is abstract.
85 86 87 |
# File 'lib/yoda/model/function_signatures/rbs_method.rb', line 85 def parameter_type_of(param) fail NotImplementedError end |
#parameters ⇒ ParameterList
This method is abstract.
64 65 66 |
# File 'lib/yoda/model/function_signatures/rbs_method.rb', line 64 def parameters ParameterList.from_rbs_method_type(rbs_method_typedef.type) end |
#rbs_type(_env) ⇒ RBS::MethodType
33 34 35 |
# File 'lib/yoda/model/function_signatures/rbs_method.rb', line 33 def rbs_type(_env) rbs_method_typedef.type end |
#sep ⇒ Object
28 29 30 |
# File 'lib/yoda/model/function_signatures/rbs_method.rb', line 28 def sep rbs_definition.instance_type? ? "#" : "." end |
#sources ⇒ Array<(String, Integer, Integer)>
69 70 71 72 73 74 75 76 |
# File 'lib/yoda/model/function_signatures/rbs_method.rb', line 69 def sources location = rbs_method_typedef.comment.location if location [[location.name, *location.start_loc]] else [] end end |
#tags ⇒ Array<Store::Objects::Tag>
58 59 60 |
# File 'lib/yoda/model/function_signatures/rbs_method.rb', line 58 def [] end |
#to_s ⇒ String
79 80 81 |
# File 'lib/yoda/model/function_signatures/rbs_method.rb', line 79 def to_s "#{name}#{rbs_method_typedef.type.to_s}" end |
#type ⇒ TypeExpressions::FunctionType
24 25 26 |
# File 'lib/yoda/model/function_signatures/rbs_method.rb', line 24 def type fail NotImplementedError end |
#visibility ⇒ Symbol
38 39 40 |
# File 'lib/yoda/model/function_signatures/rbs_method.rb', line 38 def visibility rbs_method_definition.accessibility end |