Class: YARD::Handlers::Ruby::Legacy::Base Abstract
- Inherits:
-
Base
- Object
- Base
- YARD::Handlers::Ruby::Legacy::Base
- Includes:
- Parser::Ruby::Legacy::RubyToken
- Defined in:
- lib/yard/handlers/ruby/legacy/base.rb
Overview
See Base for subclassing information.
This is the base handler for the legacy parser. To implement a legacy handler, subclass this class.
Constant Summary
Instance Attribute Summary
Attributes inherited from Base
#namespace, #owner, #parser, #scope, #statement, #visibility
Class Method Summary (collapse)
-
+ (Boolean) handles?(stmt)
Whether or not a Parser::Ruby::Legacy::Statement object should be handled by this handler.
Instance Method Summary (collapse)
-
- (Object) parse_block(opts = {})
protected
Parses a statement's block with a set of state values.
Methods inherited from Base
clear_subclasses, #ensure_loaded!, handlers, handles, #initialize, namespace_only, namespace_only?, #process, process, #push_state, #register, subclasses
Constructor Details
This class inherits a constructor from YARD::Handlers::Base
Class Method Details
+ (Boolean) handles?(stmt)
Whether or not a Parser::Ruby::Legacy::Statement object should be handled by this handler.
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/yard/handlers/ruby/legacy/base.rb', line 14 def self.handles?(stmt) handlers.any? do |a_handler| case a_handler when String stmt.tokens.first.text == a_handler when Regexp stmt.tokens.to_s =~ a_handler else a_handler == stmt.tokens.first.class end end end |
Instance Method Details
- (Object) parse_block(opts = {}) (protected)
Parses a statement's block with a set of state values. If the statement has no block, nothing happens. A description of state values can be found at Base#push_state
36 37 38 39 40 41 42 43 |
# File 'lib/yard/handlers/ruby/legacy/base.rb', line 36 def parse_block(opts = {}) push_state(opts) do if statement.block blk = Parser::Ruby::Legacy::StatementList.new(statement.block) parser.process(blk) end end end |