Class: Twostroke::AST::Ternary
- Defined in:
- lib/twostroke/ast/ternary.rb
Instance Attribute Summary collapse
-
#condition ⇒ Object
Returns the value of attribute condition.
-
#if_false ⇒ Object
Returns the value of attribute if_false.
-
#if_true ⇒ Object
Returns the value of attribute if_true.
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/ternary.rb', line 3 def condition @condition end |
#if_false ⇒ Object
Returns the value of attribute if_false.
3 4 5 |
# File 'lib/twostroke/ast/ternary.rb', line 3 def if_false @if_false end |
#if_true ⇒ Object
Returns the value of attribute if_true.
3 4 5 |
# File 'lib/twostroke/ast/ternary.rb', line 3 def if_true @if_true end |
Instance Method Details
#collapse ⇒ Object
5 6 7 |
# File 'lib/twostroke/ast/ternary.rb', line 5 def collapse self.class.new condition: condition.collapse, if_true: if_true.collapse, if_false: if_false.collapse end |
#walk(&bk) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/twostroke/ast/ternary.rb', line 9 def walk(&bk) if yield self condition.walk &bk if_true.walk &bk if_false.walk &bk end end |