Class: RBS::Inline::AST::Annotations::Inherits

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

Overview

‘# @rbs inherits T`

Instance Attribute Summary collapse

Attributes inherited from Base

#source, #tree

Instance Method Summary collapse

Constructor Details

#initialize(tree, source) ⇒ Inherits

Returns a new instance of Inherits.



432
433
434
435
436
437
438
439
440
441
442
443
# File 'lib/rbs/inline/ast/annotations.rb', line 432

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

  inherits = tree.nth_tree!(1)
  if super_type = inherits.nth_type(1)
    if super_type.is_a?(Types::ClassInstance)
      @super_name = super_type.name
      @args = super_type.args
    end
  end
end

Instance Attribute Details

#argsObject (readonly)

: Array?



429
430
431
# File 'lib/rbs/inline/ast/annotations.rb', line 429

def args
  @args
end

#super_nameObject (readonly)

: TypeName?



428
429
430
# File 'lib/rbs/inline/ast/annotations.rb', line 428

def super_name
  @super_name
end