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

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

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.



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

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

  @type = tree.nth_type!(1)
end

Instance Attribute Details

#typeTypes::t (readonly)

: Types::t

Returns:

  • (Types::t)


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

def type
  @type
end

Instance Method Details

#type_sourceString

: String

Returns:

  • (String)


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

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