Class: Twostroke::AST::If
Instance Attribute Summary collapse
-
#condition ⇒ Object
Returns the value of attribute condition.
-
#else ⇒ Object
Returns the value of attribute else.
-
#then ⇒ Object
Returns the value of attribute then.
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Twostroke::AST::Base
Instance Attribute Details
#condition ⇒ Object
Returns the value of attribute condition.
3 4 5 |
# File 'lib/twostroke/ast/if.rb', line 3 def condition @condition end |
#else ⇒ Object
Returns the value of attribute else.
3 4 5 |
# File 'lib/twostroke/ast/if.rb', line 3 def else @else end |
#then ⇒ Object
Returns the value of attribute then.
3 4 5 |
# File 'lib/twostroke/ast/if.rb', line 3 def then @then end |
Instance Method Details
#collapse ⇒ Object
5 6 7 |
# File 'lib/twostroke/ast/if.rb', line 5 def collapse self.class.new condition: condition.collapse, then: @then.collapse, else: @else && @else.collapse end |
#walk(&bk) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/twostroke/ast/if.rb', line 9 def walk(&bk) if yield self condition.walk &bk @then.walk &bk @else.walk &bk if @else end end |