Class: Postscript::Model::Operators::ControlFlow::For
- Inherits:
-
Postscript::Model::Operator
- Object
- Postscript::Model::Operator
- Postscript::Model::Operators::ControlFlow::For
- Defined in:
- lib/postscript/model/operators/control_flow.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#increment ⇒ Object
readonly
Returns the value of attribute increment.
-
#initial ⇒ Object
readonly
Returns the value of attribute initial.
-
#limit ⇒ Object
readonly
Returns the value of attribute limit.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(initial:, increment:, limit:, body:) ⇒ For
constructor
A new instance of For.
Methods inherited from Postscript::Model::Operator
#accept, #operator?, register_as
Constructor Details
#initialize(initial:, increment:, limit:, body:) ⇒ For
Returns a new instance of For.
69 70 71 72 73 74 75 |
# File 'lib/postscript/model/operators/control_flow.rb', line 69 def initialize(initial:, increment:, limit:, body:) @initial = initial @increment = increment @limit = limit @body = body freeze end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
68 69 70 |
# File 'lib/postscript/model/operators/control_flow.rb', line 68 def body @body end |
#increment ⇒ Object (readonly)
Returns the value of attribute increment.
68 69 70 |
# File 'lib/postscript/model/operators/control_flow.rb', line 68 def increment @increment end |
#initial ⇒ Object (readonly)
Returns the value of attribute initial.
68 69 70 |
# File 'lib/postscript/model/operators/control_flow.rb', line 68 def initial @initial end |
#limit ⇒ Object (readonly)
Returns the value of attribute limit.
68 69 70 |
# File 'lib/postscript/model/operators/control_flow.rb', line 68 def limit @limit end |
Class Method Details
.from_operands(stack) ⇒ Object
76 77 78 79 80 81 82 |
# File 'lib/postscript/model/operators/control_flow.rb', line 76 def self.from_operands(stack) body = stack.pop limit = stack.pop_number increment = stack.pop_number initial = stack.pop_number new(initial: initial, increment: increment, limit: limit, body: body) end |