Class: RBS::Inline::AST::Annotations::Application

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

Overview

‘#[TYPE, …, TYPE]`

Instance Attribute Summary collapse

Attributes inherited from Base

#source, #tree

Instance Method Summary collapse

Constructor Details

#initialize(tree, source) ⇒ Application

Returns a new instance of Application.



366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
# File 'lib/rbs/inline/ast/annotations.rb', line 366

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

  if ts = tree.nth_tree(0)
    if types = ts.nth_tree(1)
      @types = types.non_trivia_trees.each_slice(2).map do |type, comma|
        # @type break: nil

        case type
        when AST::Tree, MethodType, Array, nil
          break
        else
          type
        end
      end
    end
  end
end

Instance Attribute Details

#typesObject (readonly)

: Array?



363
364
365
# File 'lib/rbs/inline/ast/annotations.rb', line 363

def types
  @types
end

Instance Method Details

#complete?Boolean

Returns:

  • (Boolean)


387
388
389
# File 'lib/rbs/inline/ast/annotations.rb', line 387

def complete?
  types ? true : false
end