Class: Postsvg::Model::Operators::ControlFlow::Ifelse
- Inherits:
-
Postsvg::Model::Operator
- Object
- Postsvg::Model::Operator
- Postsvg::Model::Operators::ControlFlow::Ifelse
- Defined in:
- lib/postsvg/model/operators/control_flow.rb
Instance Attribute Summary collapse
-
#condition ⇒ Object
readonly
Returns the value of attribute condition.
-
#else_body ⇒ Object
readonly
Returns the value of attribute else_body.
-
#if_body ⇒ Object
readonly
Returns the value of attribute if_body.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(condition:, if_body:, else_body:) ⇒ Ifelse
constructor
A new instance of Ifelse.
Methods inherited from Postsvg::Model::Operator
#accept, #operator?, register_as
Constructor Details
#initialize(condition:, if_body:, else_body:) ⇒ Ifelse
Returns a new instance of Ifelse.
25 26 27 28 29 30 |
# File 'lib/postsvg/model/operators/control_flow.rb', line 25 def initialize(condition:, if_body:, else_body:) @condition = condition @if_body = if_body @else_body = else_body freeze end |
Instance Attribute Details
#condition ⇒ Object (readonly)
Returns the value of attribute condition.
24 25 26 |
# File 'lib/postsvg/model/operators/control_flow.rb', line 24 def condition @condition end |
#else_body ⇒ Object (readonly)
Returns the value of attribute else_body.
24 25 26 |
# File 'lib/postsvg/model/operators/control_flow.rb', line 24 def else_body @else_body end |
#if_body ⇒ Object (readonly)
Returns the value of attribute if_body.
24 25 26 |
# File 'lib/postsvg/model/operators/control_flow.rb', line 24 def if_body @if_body end |
Class Method Details
.from_operands(stack) ⇒ Object
31 32 33 34 35 36 |
# File 'lib/postsvg/model/operators/control_flow.rb', line 31 def self.from_operands(stack) else_body = stack.pop if_body = stack.pop condition = stack.pop new(condition: condition, if_body: if_body, else_body: else_body) end |