class YARD::Handlers::Ruby::HandlesExtension
end
handles MyExtension.new(‘foo’)
class MyHandler < Handlers::Ruby::Base
# This handler will handle any node where the source includes ‘foo’
end
def matches?(node) node.source.include?(name) end
class MyExtension < HandlesExtension
# in the node’s source.
# Implements a handler that checks for a specific string
@example A Custom Handler Matcher Extension
{#matches?} to return whether a node matches the handler.
To implement a custom handler matcher, subclass this class and implement
def initialize(name) @name = name end
-
name(Object) -- the matcher value to check against {#matches?}
def initialize(name) @name = name end
def matches?(node) # rubocop:disable Lint/UnusedMethodArgument
-
(Boolean)- whether the +node+ matches the handler
Parameters:
-
node(Parser::Ruby::AstNode) -- a Ruby node
def matches?(node) # rubocop:disable Lint/UnusedMethodArgument raise NotImplementedError end