Class: RBS::AST::Ruby::Annotations::ColonMethodTypeAnnotation

Inherits:
Base
  • Object
show all
Defined in:
lib/rbs/ast/ruby/annotations.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#location, #prefix_location

Instance Method Summary collapse

Methods inherited from Base

#buffer

Constructor Details

#initialize(location:, prefix_location:, annotations:, method_type:) ⇒ ColonMethodTypeAnnotation

Returns a new instance of ColonMethodTypeAnnotation.



85
86
87
88
89
# File 'lib/rbs/ast/ruby/annotations.rb', line 85

def initialize(location:, prefix_location:, annotations:, method_type:)
  super(location, prefix_location)
  @annotations = annotations
  @method_type = method_type
end

Instance Attribute Details

#annotationsObject (readonly)

Returns the value of attribute annotations.



83
84
85
# File 'lib/rbs/ast/ruby/annotations.rb', line 83

def annotations
  @annotations
end

#method_typeObject (readonly)

Returns the value of attribute method_type.



83
84
85
# File 'lib/rbs/ast/ruby/annotations.rb', line 83

def method_type
  @method_type
end

Instance Method Details

#map_type_nameObject



91
92
93
94
95
96
97
98
# File 'lib/rbs/ast/ruby/annotations.rb', line 91

def map_type_name
  self.class.new(
    location:,
    prefix_location:,
    annotations: annotations,
    method_type: method_type.map_type {|type| type.map_type_name { yield _1 }}
  ) #: self
end

#type_fingerprintObject



100
101
102
103
104
105
106
# File 'lib/rbs/ast/ruby/annotations.rb', line 100

def type_fingerprint
  [
    "annots/colon_method_type",
    annotations.map(&:to_s),
    method_type.to_s
  ]
end