Method: YARD::Handlers::Processor#globals

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

#globalsOpenStruct

Handlers can share state for the entire post processing stage through this attribute. Note that post processing stage spans multiple files. To share state only within a single file, use #extra_state

Examples:

Sharing state among two handlers

class Handler1 < YARD::Handlers::Ruby::Base
  handles :class
  process { globals.foo = :bar }
end

class Handler2 < YARD::Handlers::Ruby::Base
  handles :method
  process { puts globals.foo }
end

Returns:

  • (OpenStruct)

    global shared state for post-processing stage

See Also:


79
80
81
# File 'lib/yard/handlers/processor.rb', line 79

def globals
  @globals
end