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

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

Overview

: METHOD-TYPE annotation in leading comments

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.

Parameters:



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

#annotationsArray[AST::Annotation] (readonly)

Returns the value of attribute annotations.

Returns:



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

def annotations
  @annotations
end

#method_typeMethodType (readonly)

Returns the value of attribute method_type.

Returns:



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

def method_type
  @method_type
end

Instance Method Details

#map_type_name {|arg0| ... } ⇒ self

Yields:

Yield Parameters:

Yield Returns:

Returns:

  • (self)


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

Returns:

  • (Object)


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