Method: YARD::Parser::Ruby::Legacy::TokenList#push

Defined in:
lib/yard/parser/ruby/legacy/token_list.rb

#push(*tokens) ⇒ Object Also known as: <<

Parameters:

  • tokens (TokenList, Token, String)

    A list of tokens. If the token is a string, it is parsed with RubyLex.



21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/yard/parser/ruby/legacy/token_list.rb', line 21

def push(*tokens)
  tokens.each do |tok|
    if tok.is_a?(TokenList) || tok.is_a?(Array)
      concat tok
    elsif tok.is_a?(Token)
      super tok
    elsif tok.is_a?(String)
      parse_content(tok)
    else
      raise ArgumentError, "Expecting token, list of tokens or string of code to be tokenized. Got #{tok.class}"
    end
  end
  self
end