class YARD::Handlers::Ruby::Base
@see Legacy::Base
@see Handlers::Base
@abstract See {Handlers::Base} for subclassing information.
{Legacy::Base}.
new-style parser is used. For implementing legacy handlers, see
All handlers that subclass this base class will be used when the
This is the base handler class for the new-style (1.9) Ruby parser.
def call_params
def call_params return [] unless statement.respond_to?(:parameters) statement.parameters(false).compact.map do |param| if param.type == :list param.map {|n| n.jump(:ident, :kw, :tstring_content).source } else param.jump(:ident, :kw, :tstring_content).source end end.flatten end
def caller_method
def caller_method if statement.call? || statement.def? statement.method_name(true).to_s elsif statement.type == :var_ref || statement.type == :vcall statement[0].jump(:ident, :kw).source end end
def handles?(node)
-
(Boolean)
- whether or not an {AstNode} object should be
def handles?(node) handlers.any? do |a_handler| case a_handler when Symbol a_handler == node.type when String node.source == a_handler when Regexp node.source =~ a_handler when Parser::Ruby::AstNode a_handler == node when HandlesExtension a_handler.matches?(node) end end end
def meta_type(type)
-
(void)
-
Parameters:
-
type
(Symbol
) -- the meta-type to match. A meta-type can be
Other tags:
- Example: Handling any conditional statement (if, unless) -
def meta_type(type) TestNodeWrapper.new(type.to_s + "?") end
def method_call(name = nil)
-
(void)
-
Parameters:
-
name
(#to_s
) -- matches the method call of this name
Other tags:
- Example: Match the "describe" method call -
def method_call(name = nil) MethodCallWrapper.new(name ? name.to_s : nil) end
def parse_block(inner_node, opts = {})
def parse_block(inner_node, opts = {}) push_state(opts) do nodes = inner_node.type == :list ? inner_node.children : [inner_node] parser.process(nodes) end end