class YARD::Tags::Directive
@since 0.8.0
@see Library.define_directive
@abstract Subclasses should implement {#call}.
before attempting to use them.
attributes may be nil, and directives should test their existence
to modify the generated code object directly. Note that both of these
attached to an object declaration, {#object} will be set and available
not when parsing directly from {DocstringParser}. If the docstring is
Handlers are only available when parsing from {Parser::SourceParser},
available to access more information about parsing context and state.
If processing occurs within a handler, the {#handler} attribute is
processing on the object.
classes are executed via the {#call} method, which perform all directive
directive, registering it with {Library.define_directive}. Directive
The base directive class. Subclass this class to create a custom
def after_parse; end
-
(void)
-
def after_parse; end
def call; raise NotImplementedError end
-
(void)
-
Other tags:
- Abstract: - implement this method to perform all data processing for
def call; raise NotImplementedError end
def handler; parser.handler end
-
(Handlers::Base, nil)
- the handler object the docstring parser
def handler; parser.handler end
def initialize(tag, parser)
-
parser
(DocstringParser
) -- the docstring parser object -
tag
(Tag
) -- the meta-data tag containing all input to the docstring
def initialize(tag, parser) self.tag = tag self.parser = parser self.expanded_text = nil end
def inside_directive?
def inside_directive? return true if parser.state.inside_directive parser.directives.any? { |d| d.is_a?(MethodDirective) && d.tag.text.empty? } end
def object; parser.object end
-
(CodeObjects::Base, nil)
- the object the parent docstring is
def object; parser.object end