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

Inherits:
KeywordNode show all
Defined in:
lib/yard/parser/ruby/ast_node.rb

Constant Summary

Constants inherited from AstNode

AstNode::KEYWORDS

Instance Attribute Summary

Attributes inherited from AstNode

#docstring, #docstring_hash_flag, #docstring_range, #file, #full_source, #group, #line_range, #parent, #source, #source_range, #type

Managing node state collapse

Methods inherited from KeywordNode

#kw?

Methods inherited from AstNode

#==, #block?, #call?, #children, #def?, #first_line, #has_line?, #initialize, #inspect, #jump, #kw?, #line, #literal?, #loop?, node_class_for, #pretty_print, #ref?, #show, #to_s, #token?, #traverse, #unfreeze

Methods inherited from Array

#place

Constructor Details

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

Instance Method Details

#conditionObject



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

def condition; first end

#condition?Boolean

Returns:

  • (Boolean)


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

def condition?; true end

#else_blockObject



520
521
522
523
# 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_blockObject



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

def then_block; self[1] end