Class: Postscript::Model::Operators::ControlFlow::If
- Inherits:
-
Postscript::Model::Operator
- Object
- Postscript::Model::Operator
- Postscript::Model::Operators::ControlFlow::If
- Defined in:
- lib/postscript/model/operators/control_flow.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#condition ⇒ Object
readonly
Returns the value of attribute condition.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(condition:, body:) ⇒ If
constructor
A new instance of If.
Methods inherited from Postscript::Model::Operator
#accept, #operator?, register_as
Constructor Details
#initialize(condition:, body:) ⇒ If
Returns a new instance of If.
10 11 12 13 14 |
# File 'lib/postscript/model/operators/control_flow.rb', line 10 def initialize(condition:, body:) @condition = condition @body = body freeze end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
9 10 11 |
# File 'lib/postscript/model/operators/control_flow.rb', line 9 def body @body end |
#condition ⇒ Object (readonly)
Returns the value of attribute condition.
9 10 11 |
# File 'lib/postscript/model/operators/control_flow.rb', line 9 def condition @condition end |
Class Method Details
.from_operands(stack) ⇒ Object
15 16 17 18 19 |
# File 'lib/postscript/model/operators/control_flow.rb', line 15 def self.from_operands(stack) body = stack.pop condition = stack.pop new(condition: condition, body: body) end |