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

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

Overview

: TYPE annotation attached to nodes

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.

Parameters:



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

#typeTypes::t (readonly)

Returns the value of attribute type.

Returns:

  • (Types::t)


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

def type
  @type
end

Instance Method Details

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

Yields:

Yield Parameters:

Yield Returns:

Returns:

  • (self)


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

Returns:

  • (Object)


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