Class/Module Index [+]

Quicksearch

YARD::Handlers::Ruby::Legacy::Base

This is the base handler for the legacy parser. To implement a legacy handler, subclass this class.

@abstract (see Ruby::Base)

Public Class Methods

handles?(stmt) click to toggle source

@return [Boolean] whether or not a {Parser::Ruby::Legacy::Statement} object should be handled

by this handler.
# File lib/yard/handlers/ruby/legacy/base.rb, line 14
def self.handles?(stmt)
  handlers.any? do |a_handler|
    case a_handler
    when String
      stmt.tokens.first.text == a_handler
    when Regexp
      stmt.tokens.to_s =~ a_handler
    else
      a_handler == stmt.tokens.first.class
    end
  end
end

Public Instance Methods

call_params() click to toggle source
# File lib/yard/handlers/ruby/legacy/base.rb, line 43
def call_params
  if statement.tokens.first.is_a?(TkDEF)
    extract_method_details.last.map {|param| param.first }
  else
    tokens = statement.tokens[1..-1]
    tokval_list(tokens, :attr, :identifier, TkId).map do |value|
      value.to_s
    end
  end
end
caller_method() click to toggle source
# File lib/yard/handlers/ruby/legacy/base.rb, line 54
def caller_method
  if statement.tokens.first.is_a?(TkIDENTIFIER)
    statement.tokens.first.text
  elsif statement.tokens.first.is_a?(TkDEF)
    extract_method_details.first
  else
    nil
  end
end
parse_block(opts = {}) click to toggle source

Parses a statement's block with a set of state values. If the statement has no block, nothing happens. A description of state values can be found at {Handlers::Base#push_state}

@param [Hash] opts State options @option opts (see Handlers::Base#push_state) @see Handlers::Base#push_state push_state

# File lib/yard/handlers/ruby/legacy/base.rb, line 34
def parse_block(opts = {})
  push_state(opts) do
    if statement.block
      blk = Parser::Ruby::Legacy::StatementList.new(statement.block)
      parser.process(blk)
    end
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.