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

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

Constant Summary

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

#s

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?(node)

Returns:

  • (Boolean)


43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/yard/handlers/ruby/base.rb', line 43

def handles?(node)
  handlers.any? do |a_handler| 
    case a_handler 
    when Symbol
      a_handler == node.type
    when String
      node.source == a_handler
    when Regexp
      node.source =~ a_handler
    when Parser::Ruby::AstNode
      a_handler == node
    when HandlesExtension
      a_handler.matches?(node)
    end
  end
end

+ (Object) meta_type(meth)



39
40
41
# File 'lib/yard/handlers/ruby/base.rb', line 39

def meta_type(meth)
  TestNodeWrapper.new(meth.to_s + "?")
end

+ (Object) method_call(name)



35
36
37
# File 'lib/yard/handlers/ruby/base.rb', line 35

def method_call(name)
  MethodCallWrapper.new(name.to_s)
end

Instance Method Details

- (Object) parse_block(inner_node, opts = {})



63
64
65
66
67
68
# File 'lib/yard/handlers/ruby/base.rb', line 63

def parse_block(inner_node, opts = {})
  push_state(opts) do
    nodes = inner_node.type == :list ? inner_node.children : [inner_node]
    parser.process(nodes)
  end
end