Class: YARD::Handlers::RBS::Base
- Inherits:
-
Handlers::Base
- Object
- Handlers::Base
- YARD::Handlers::RBS::Base
- Defined in:
- lib/yard/handlers/rbs/base.rb
Overview
Base class for all RBS handlers. Handlers match on the Parser::RBS::Statement#type symbol of the current statement and process it to create or annotate code objects.
Direct Known Subclasses
AttributeHandler, ConstantHandler, MethodHandler, MixinHandler, NamespaceHandler
Class Method Summary collapse
-
.handles?(statement, _processor) ⇒ Boolean
Whether this handler matches the given statement.
Instance Method Summary collapse
-
#parse_block(opts = {}) ⇒ Object
Recurse into the body of a namespace statement.
Class Method Details
.handles?(statement, _processor) ⇒ Boolean
Returns whether this handler matches the given statement.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/yard/handlers/rbs/base.rb', line 11 def self.handles?(statement, _processor) handlers.any? do |matcher| case matcher when Symbol statement.type == matcher when String statement.type.to_s == matcher when Regexp (statement.source || '') =~ matcher else false end end end |
Instance Method Details
#parse_block(opts = {}) ⇒ Object
Recurse into the body of a namespace statement.
29 30 31 32 33 34 |
# File 'lib/yard/handlers/rbs/base.rb', line 29 def parse_block(opts = {}) return if statement.block.nil? || statement.block.empty? push_state(opts) do parser.process(statement.block) end end |