Class: Glaemscribe::API::IfTree::IfCond

Inherits:
Object
  • Object
show all
Defined in:
lib/api/if_tree.rb

Overview

A branching if condition

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(line, parent_if_term, expression) ⇒ IfCond

Returns a new instance of IfCond.



30
31
32
33
# File 'lib/api/if_tree.rb', line 30

def initialize(line, parent_if_term, expression)
  @parent_if_term     = parent_if_term
  @expression         = expression
end

Instance Attribute Details

#child_code_blockObject

Returns the value of attribute child_code_block.



29
30
31
# File 'lib/api/if_tree.rb', line 29

def child_code_block
  @child_code_block
end

#expressionObject

Returns the value of attribute expression.



29
30
31
# File 'lib/api/if_tree.rb', line 29

def expression
  @expression
end

#lineObject

Returns the value of attribute line.



29
30
31
# File 'lib/api/if_tree.rb', line 29

def line
  @line
end

#parent_if_termObject

Returns the value of attribute parent_if_term.



29
30
31
# File 'lib/api/if_tree.rb', line 29

def parent_if_term
  @parent_if_term
end

Instance Method Details

#inspectObject



40
41
42
43
# File 'lib/api/if_tree.rb', line 40

def inspect
  "#{prefix} IF #{expression}\n" + 
  "#{child_code_block.inspect}"
end

#offsetObject



34
35
36
# File 'lib/api/if_tree.rb', line 34

def offset
  parent_if_term.offset + " "
end

#prefixObject



37
38
39
# File 'lib/api/if_tree.rb', line 37

def prefix
  offset + "|-"
end