class YARD::Handlers::RBS::Base

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.

Public Class Methods

handles?(statement, _processor) click to toggle source

@return [Boolean] whether this handler matches the given statement

# 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

Public Instance Methods

parse_block(opts = {}) click to toggle source

Recurse into the body of a namespace statement. @param opts [Hash] state overrides @see push_state

# 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