Class | YARD::Handlers::Processor |
In: |
lib/yard/handlers/processor.rb
|
Parent: | Object |
Iterates over all statements in a file and delegates them to the {Handlers::Base} objects that are registered to handle the statement.
This class is passed to each handler and keeps overall processing state. For example, if the {visibility} is set in a handler, all following statements will have access to this state. This allows "public", "protected" and "private" statements to be handled in classes and modules. In addition, the {namespace} can be set during parsing to control where objects are being created from. You can also access extra stateful properties that any handler can set during the duration of the post processing of a file from {extra_state}. If you need to access state across different files, look at {globals}.
@see Handlers::Base
extra_state | [RW] |
Share state across different handlers inside of a file. This attribute is
similar to {visibility}, {scope}, {namespace} and {owner}, in that they all
maintain state across all handlers for the entire source file. Use this
attribute to store any data your handler might need to save during the
parsing of a file. If you need to save state across files, see {globals}.
@return [OpenStruct] an open structure that can store arbitrary data @see globals |
file | [RW] | @return [String] the filename |
globals | [RW] |
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}
@example 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 @return [OpenStruct] global shared state for post-processing stage @see extra_state |
namespace | [RW] | @return [CodeObjects::NamespaceObject] the current namespace |
namespace_for_handler | [R] | @return [Hash] a list of registered parser type extensions @private @since 0.6.0 |
owner | [RW] |
@return [CodeObjects::Base, nil]
unlike the namespace, the owner
is a non-namespace object that should be stored between statements. For instance, when parsing a method body, the {CodeObjects::MethodObject} is set as the owner, in case any extra method information is processed. |
parser_type | [RW] | @return [Symbol] the parser type (:ruby, :ruby18, :c) |
scope | [RW] | @return [Symbol] the current scope (class, instance) |
visibility | [RW] | @return [Symbol] the current visibility (public, private, protected) |
Registers a new namespace for handlers of the given type. @since 0.6.0
Searches for all handlers in {Base.subclasses} that match the statement
@param statement the statement object to match. @return [Array<Base>] a list of handlers to process the statement with.
Continue parsing the remainder of the files in the +globals.ordered_parser+ object. After the remainder of files are parsed, processing will continue on the current file.
@return [void] @see Parser::OrderedParser