Class: RBS::Inline::AST::Annotations::TypeAssertion

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

Instance Attribute Summary collapse

Attributes inherited from Base

#source, #tree

Instance Method Summary collapse

Constructor Details

#initialize(tree, source) ⇒ TypeAssertion

Returns a new instance of TypeAssertion.



328
329
330
331
332
333
# File 'lib/rbs/inline/ast/annotations.rb', line 328

def initialize(tree, source)
  @source = source
  @tree = tree

  @type = tree.nth_type!(1)
end

Instance Attribute Details

#typeObject (readonly)

: Types::t



325
326
327
# File 'lib/rbs/inline/ast/annotations.rb', line 325

def type
  @type
end

Instance Method Details

#type_sourceObject

: String



335
336
337
# File 'lib/rbs/inline/ast/annotations.rb', line 335

def type_source #: String
  type.location&.source || raise
end