Class: Postscript::Model::Operators::ControlFlow::Repeat
- Inherits:
-
Postscript::Model::Operator
- Object
- Postscript::Model::Operator
- Postscript::Model::Operators::ControlFlow::Repeat
- Defined in:
- lib/postscript/model/operators/control_flow.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#count ⇒ Object
readonly
Returns the value of attribute count.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(count:, body:) ⇒ Repeat
constructor
A new instance of Repeat.
Methods inherited from Postscript::Model::Operator
#accept, #operator?, register_as
Constructor Details
#initialize(count:, body:) ⇒ Repeat
Returns a new instance of Repeat.
42 43 44 45 46 |
# File 'lib/postscript/model/operators/control_flow.rb', line 42 def initialize(count:, body:) @count = count @body = body freeze end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
41 42 43 |
# File 'lib/postscript/model/operators/control_flow.rb', line 41 def body @body end |
#count ⇒ Object (readonly)
Returns the value of attribute count.
41 42 43 |
# File 'lib/postscript/model/operators/control_flow.rb', line 41 def count @count end |
Class Method Details
.from_operands(stack) ⇒ Object
47 48 49 50 51 |
# File 'lib/postscript/model/operators/control_flow.rb', line 47 def self.from_operands(stack) body = stack.pop count = stack.pop_number.to_i new(count: count, body: body) end |