Class: RBS::AST::Ruby::Annotations::MethodTypesAnnotation
- Defined in:
- lib/rbs/ast/ruby/annotations.rb
Constant Summary collapse
- Overload =
AST::Members::MethodDefinition::Overload
Instance Attribute Summary collapse
-
#dot3_location ⇒ Object
readonly
Returns the value of attribute dot3_location.
-
#overloads ⇒ Object
readonly
Returns the value of attribute overloads.
-
#vertical_bar_locations ⇒ Object
readonly
Returns the value of attribute vertical_bar_locations.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(location:, prefix_location:, overloads:, vertical_bar_locations:, dot3_location:) ⇒ MethodTypesAnnotation
constructor
A new instance of MethodTypesAnnotation.
- #map_type_name(&block) ⇒ Object
- #type_fingerprint ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(location:, prefix_location:, overloads:, vertical_bar_locations:, dot3_location:) ⇒ MethodTypesAnnotation
Returns a new instance of MethodTypesAnnotation.
114 115 116 117 118 119 |
# File 'lib/rbs/ast/ruby/annotations.rb', line 114 def initialize(location:, prefix_location:, overloads:, vertical_bar_locations:, dot3_location:) super(location, prefix_location) @overloads = overloads @vertical_bar_locations = @dot3_location = dot3_location end |
Instance Attribute Details
#dot3_location ⇒ Object (readonly)
Returns the value of attribute dot3_location.
112 113 114 |
# File 'lib/rbs/ast/ruby/annotations.rb', line 112 def dot3_location @dot3_location end |
#overloads ⇒ Object (readonly)
Returns the value of attribute overloads.
112 113 114 |
# File 'lib/rbs/ast/ruby/annotations.rb', line 112 def overloads @overloads end |
#vertical_bar_locations ⇒ Object (readonly)
Returns the value of attribute vertical_bar_locations.
112 113 114 |
# File 'lib/rbs/ast/ruby/annotations.rb', line 112 def @vertical_bar_locations end |
Instance Method Details
#map_type_name(&block) ⇒ Object
121 122 123 124 125 126 127 128 129 130 |
# File 'lib/rbs/ast/ruby/annotations.rb', line 121 def map_type_name(&block) ovs = overloads.map do |overload| Overload.new( method_type: overload.method_type.map_type {|type| type.map_type_name { yield _1 } }, annotations: overload.annotations ) end self.class.new(location:, prefix_location:, overloads: ovs, vertical_bar_locations:, dot3_location:) #: self end |
#type_fingerprint ⇒ Object
132 133 134 135 136 137 138 |
# File 'lib/rbs/ast/ruby/annotations.rb', line 132 def type_fingerprint [ "annots/method_types", overloads.map { |o| [o.annotations.map(&:to_s), o.method_type.to_s] }, overloading: dot3_location ? true : false ] end |