Class: 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
Constant Summary
Constants included from CodeObjects
CodeObjects::BUILTIN_ALL, CodeObjects::BUILTIN_CLASSES, CodeObjects::BUILTIN_EXCEPTIONS, CodeObjects::BUILTIN_EXCEPTIONS_HASH, CodeObjects::BUILTIN_MODULES, CodeObjects::CONSTANTMATCH, CodeObjects::CONSTANTSTART, CodeObjects::CSEP, CodeObjects::CSEPQ, CodeObjects::ISEP, CodeObjects::ISEPQ, CodeObjects::METHODMATCH, CodeObjects::METHODNAMEMATCH, CodeObjects::NAMESPACEMATCH, CodeObjects::NSEP, CodeObjects::NSEPQ
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.
Methods included from CodeObjects::NamespaceMapper
#clear_separators, #default_separator, on_invalidate, #register_separator, #separators, #separators_for_type, #separators_match, #types_for_separator, #unregister_separator_by_type
Constructor Details
This class inherits a constructor from YARD::Handlers::Base
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 |