Method: YARD::Parser::SourceParser#initialize

Defined in:
lib/yard/parser/source_parser.rb

#initialize(parser_type = SourceParser.parser_type, globals = nil) ⇒ SourceParser

Returns a new instance of SourceParser.

Creates a new parser object for code parsing with a specific parser type.

Parameters:

  • parser_type (Symbol) (defaults to: SourceParser.parser_type)

    the parser type to use

  • globals (OpenStruct) (defaults to: nil)

    global state to be re-used across separate source files


404
405
406
407
408
409
# File 'lib/yard/parser/source_parser.rb', line 404

def initialize(parser_type = SourceParser.parser_type, globals1 = nil, globals2 = nil)
  globals = [true, false].include?(globals1) ? globals2 : globals1
  @file = '(stdin)'
  @globals = globals || OpenStruct.new
  self.parser_type = parser_type
end