123456789_123456789_123456789_123456789_123456789_

Class: YARD::Parser::Ruby::ConditionalNode

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Inherits: YARD::Parser::Ruby::KeywordNode
Defined in: lib/yard/parser/ruby/ast_node.rb

Constant Summary

AstNode - Inherited

KEYWORDS

Managing node state

Class Method Summary

AstNode - Inherited

.new

Creates a new AST node.

.node_class_for

Finds the node subclass that should be instantiated for a specific node type.

Instance Attribute Summary

Instance Method Summary

AstNode - Inherited

#==, #children, #first_line, #inspect,
#jump

Searches through the node and all descendants and returns the first node with a type matching any of node_types, otherwise returns the original node (self).

#line, #pretty_print, #show,
#traverse

Traverses the object and yields each node (including descendants) in order.

#unfreeze

Resets node state in tree.

#reset_line_info

Resets line information.

::Array - Inherited

#place

Places values before or after another object (by value) in an array.

Constructor Details

This class inherits a constructor from YARD::Parser::Ruby::AstNode

Instance Attribute Details

#cmod?Boolean (readonly, private)

[ GitHub ]

  
# File 'lib/yard/parser/ruby/ast_node.rb', line 527

def cmod?; type =~ /_mod$/ end

#condition?Boolean (readonly)

[ GitHub ]

  
# File 'lib/yard/parser/ruby/ast_node.rb', line 516

def condition?; true end

Instance Method Details

#condition (readonly)

[ GitHub ]

  
# File 'lib/yard/parser/ruby/ast_node.rb', line 517

def condition; first end

#else_block

[ GitHub ]

  
# File 'lib/yard/parser/ruby/ast_node.rb', line 520

def else_block
  return unless self[2] && !cmod?
  self[2].type == :elsif ? self[2] : self[2][0]
end

#then_block

[ GitHub ]

  
# File 'lib/yard/parser/ruby/ast_node.rb', line 518

def then_block; self[1] end