Method: YARD::Handlers::Processor#initialize

Defined in:
lib/yard/handlers/processor.rb

#initialize(file = nil, load_order_errors = false, parser_type = Parser::SourceParser.parser_type, globals = nil) ⇒ Processor

Creates a new Processor for a file.

Parameters:

  • file (String) (defaults to: nil)

    the name of the file that is being processed. uses ‘(stdin)’ if file is nil.

  • load_order_error (Boolean)

    whether or not to raise Parser::LoadOrderError when a file has unresolved references that need to be parsed first. If these errors are raised, the processor will attempt to load all other files before continuing to parse the file.

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

    the parser type (:ruby, :ruby18, :c) from the parser. Used to select the handler (since handlers are specific to a parser type).

  • globals (OpenStruct) (defaults to: nil)

    the object holding all state during the post processing stage


105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/yard/handlers/processor.rb', line 105

def initialize(file = nil, load_order_errors = false, parser_type = Parser::SourceParser.parser_type, globals = nil)
  @file = file || "(stdin)"
  @namespace = YARD::Registry.root
  @visibility = :public
  @scope = :instance
  @owner = @namespace
  @load_order_errors = load_order_errors
  @parser_type = parser_type
  @handlers_loaded = {}
  @globals = globals || OpenStruct.new
  @extra_state = OpenStruct.new
  load_handlers
end