Method: YARD::Parser::Ruby::AstNode.node_class_for
- Defined in:
- lib/yard/parser/ruby/ast_node.rb
.node_class_for(type) ⇒ Class
Finds the node subclass that should be instantiated for a specific node type
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/yard/parser/ruby/ast_node.rb', line 110 def self.node_class_for(type) case type when :params ParameterNode when :call, :fcall, :vcall, :command, :command_call MethodCallNode when :if, :elsif, :if_mod, :unless, :unless_mod ConditionalNode when :for, :while, :while_mod, :until, :until_mod LoopNode when :def, :defs MethodDefinitionNode when :class, :sclass ClassNode when :module ModuleNode else if type.to_s =~ /_ref\Z/ ReferenceNode elsif type.to_s =~ /_literal\Z/ LiteralNode elsif KEYWORDS.has_key?(type) KeywordNode else AstNode end end end |