Class | YARD::Handlers::Ruby::HandlesExtension
In: | lib/yard/handlers/ruby/base.rb
Parent: | Object

To implement a custom handler matcher, subclass this class and implement {matches?} to return whether a node matches the handler.

@example A Custom Handler Matcher Extension

      # Implements a handler that checks for a specific string
      # in the node's source.
      class MyExtension < HandlesExtension
        def matches?(node) node.source.include?(name) end
      end

      # This handler will handle any node where the source includes 'foo'
      class MyHandler < Handlers::Ruby::Base
        handles MyExtension.new('foo')
      end

### Methods

matches? new

### Attributes

name | [R] | @return [String] the extension matcher value

### Public Class methods

new(name)

Creates a new extension with a specific matcher value `name` @param [Object] name the matcher value to check against {matches?}

### Public Instance methods

matches?(node)

Tests if the node matches the handler @param [Parser::Ruby::AstNode] node a Ruby node @return [Boolean] whether the `node` matches the handler

[Validate]