Method: YARD::Handlers::Ruby::Base.meta_type

Defined in:
lib/yard/handlers/ruby/base.rb

.meta_type(type) ⇒ void

This method returns an undefined value.

Matcher for handling a node with a specific meta-type. An Parser::Ruby::AstNode has a Parser::Ruby::AstNode#type to define its type but can also be associated with a set of types. For instance, :if and :unless are both of the meta-type :condition.

A meta-type is any method on the Parser::Ruby::AstNode class ending in “?”, though you should not include the “?” suffix in your declaration. Some examples are: “condition”, “call”, “literal”, “kw”, “token”, “ref”.

Examples:

Handling any conditional statement (if, unless)

handles meta_type(:condition)

Parameters:

  • type (Symbol)

    the meta-type to match. A meta-type can be any method name + “?” that Parser::Ruby::AstNode responds to.


102
103
104
# File 'lib/yard/handlers/ruby/base.rb', line 102

def meta_type(type)
  TestNodeWrapper.new(type.to_s + "?")
end