Class: YARD::Tags::ScopeDirective
- Defined in:
- lib/yard/tags/directives.rb
Overview
Modifies the current parsing scope (class or instance). If this directive is defined on a docstring attached to an object definition, it is applied only to that object. Otherwise, it applies the scope to all future objects in the namespace.
Instance Attribute Summary collapse
-
#expanded_text ⇒ String?
inherited
from Directive
Set this field to replace the directive definition inside of a docstring with arbitrary text.
-
#handler ⇒ Handlers::Base?
inherited
from Directive
readonly
The handler object the docstring parser might be attached to.
-
#object ⇒ CodeObjects::Base?
inherited
from Directive
readonly
The object the parent docstring is attached to.
-
#parser ⇒ DocstringParser
inherited
from Directive
protected
The parser that is parsing all tag information out of the docstring.
-
#tag ⇒ Tag
inherited
from Directive
The meta-data tag containing data input to the directive.
Parser callbacks collapse
Constructor Details
This class inherits a constructor from YARD::Tags::Directive
Instance Attribute Details
#expanded_text ⇒ String? Originally defined in class Directive
Set this field to replace the directive definition inside of a docstring with arbitrary text. For instance, the MacroDirective uses this field to expand its macro data in place of the call to a @!macro.
#handler ⇒ Handlers::Base? (readonly) Originally defined in class Directive
Returns the handler object the docstring parser might be attached to. May be nil. Only available when parsing through Parser::SourceParser.
#object ⇒ CodeObjects::Base? (readonly) Originally defined in class Directive
Returns the object the parent docstring is attached to. May be nil.
#parser ⇒ DocstringParser (protected) Originally defined in class Directive
Returns the parser that is parsing all tag information out of the docstring
Instance Method Details
#call ⇒ Object
557 558 559 560 561 562 563 564 565 |
# File 'lib/yard/tags/directives.rb', line 557 def call if %w(class instance module).include?(tag.text) if object.is_a?(CodeObjects::MethodObject) object.scope = tag.text.to_sym else parser.state.scope = tag.text.to_sym end end end |