123456789_123456789_123456789_123456789_123456789_

Class: RBS::AST::Ruby::Annotations::MethodTypesAnnotation

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Base
Instance Chain:
self, Base
Inherits: RBS::AST::Ruby::Annotations::Base
Defined in: lib/rbs/ast/ruby/annotations.rb

Constant Summary

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(location:, prefix_location:, overloads:, vertical_bar_locations:, dot3_location:) ⇒ MethodTypesAnnotation

[ GitHub ]

  
# 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 = vertical_bar_locations
  @dot3_location = dot3_location
end

Instance Attribute Details

#dot3_location (readonly)

[ GitHub ]

  
# File 'lib/rbs/ast/ruby/annotations.rb', line 112

attr_reader :overloads, :vertical_bar_locations, :dot3_location

#overloads (readonly)

[ GitHub ]

  
# File 'lib/rbs/ast/ruby/annotations.rb', line 112

attr_reader :overloads, :vertical_bar_locations, :dot3_location

#vertical_bar_locations (readonly)

[ GitHub ]

  
# File 'lib/rbs/ast/ruby/annotations.rb', line 112

attr_reader :overloads, :vertical_bar_locations, :dot3_location

Instance Method Details

#map_type_name(&block)

[ GitHub ]

  
# 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

[ GitHub ]

  
# 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