Class: RBS::AST::Ruby::Annotations::NodeTypeAssertion

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:, type:) ⇒ NodeTypeAssertion

Returns a new instance of NodeTypeAssertion.



23
24
25
26
# File 'lib/rbs/ast/ruby/annotations.rb', line 23

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

Instance Attribute Details

#typeObject (readonly)

Returns the value of attribute type.



21
22
23
# File 'lib/rbs/ast/ruby/annotations.rb', line 21

def type
  @type
end

Instance Method Details

#map_type_nameObject



28
29
30
31
32
33
# File 'lib/rbs/ast/ruby/annotations.rb', line 28

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

#type_fingerprintObject



35
36
37
38
39
40
# File 'lib/rbs/ast/ruby/annotations.rb', line 35

def type_fingerprint
  [
    "annots/node_type_assertion",
    type.to_s
  ]
end