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

Inherits:
YARD::Handlers::Base show all
Includes:
YARD::Parser::Ruby::Legacy::RubyToken
Defined in:
lib/yard/handlers/ruby/legacy/base.rb

Constant Summary

Constants included from YARD::Parser::Ruby::Legacy::RubyToken

EXPR_ARG, EXPR_BEG, EXPR_CLASS, EXPR_DOT, EXPR_END, EXPR_FNAME, EXPR_MID, NEWLINE_TOKEN, TkReading2Token, TkSymbol2Token, TokenDefinitions

Constants included from YARD::CodeObjects

BUILTIN_ALL, BUILTIN_CLASSES, BUILTIN_EXCEPTIONS, BUILTIN_EXCEPTIONS_HASH, BUILTIN_MODULES, CONSTANTMATCH, CSEP, CSEPQ, ISEP, ISEPQ, METHODMATCH, METHODNAMEMATCH, NAMESPACEMATCH, NSEP, NSEPQ

Class Method Summary

Instance Method Summary

Methods included from YARD::Parser::Ruby::Legacy::RubyToken

#Token, def_token, #set_token_position

Methods inherited from YARD::Handlers::Base

clear_subclasses, #ensure_loaded!, handlers, handles, #initialize, namespace_only, namespace_only?, #process, #push_state, #register, subclasses

Constructor Details

This class inherits a constructor from YARD::Handlers::Base

Class Method Details

+ (Boolean) handles?(stmt)

Returns:

  • (Boolean)


8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/yard/handlers/ruby/legacy/base.rb', line 8

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

Instance Method Details

- (Object) parse_block(opts = {}) (protected)



23
24
25
26
27
28
29
30
# File 'lib/yard/handlers/ruby/legacy/base.rb', line 23

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