Class: Glaemscribe::API::IfTree::CodeBlock
Instance Attribute Summary collapse
-
#parent_if_cond ⇒ Object
Returns the value of attribute parent_if_cond.
-
#terms ⇒ Object
Returns the value of attribute terms.
Instance Method Summary collapse
-
#initialize(parent_if_cond = nil) ⇒ CodeBlock
constructor
A new instance of CodeBlock.
- #inspect ⇒ Object
- #offset ⇒ Object
- #prefix ⇒ Object
Constructor Details
#initialize(parent_if_cond = nil) ⇒ CodeBlock
Returns a new instance of CodeBlock.
138 139 140 141 |
# File 'lib/api/if_tree.rb', line 138 def initialize(parent_if_cond = nil) @parent_if_cond = parent_if_cond @terms = [] end |
Instance Attribute Details
#parent_if_cond ⇒ Object
Returns the value of attribute parent_if_cond.
137 138 139 |
# File 'lib/api/if_tree.rb', line 137 def parent_if_cond @parent_if_cond end |
#terms ⇒ Object
Returns the value of attribute terms.
137 138 139 |
# File 'lib/api/if_tree.rb', line 137 def terms @terms end |
Instance Method Details
#inspect ⇒ Object
148 149 150 151 152 153 |
# File 'lib/api/if_tree.rb', line 148 def inspect ret = "" ret += "|-ROOT\n" if !parent_if_cond ret += "#{prefix} Code block\n" + @terms.map{|t| t.inspect}.join("\n") end |
#offset ⇒ Object
142 143 144 |
# File 'lib/api/if_tree.rb', line 142 def offset ((parent_if_cond)?(parent_if_cond.offset):("")) + " " end |
#prefix ⇒ Object
145 146 147 |
# File 'lib/api/if_tree.rb', line 145 def prefix offset + "|- " end |