Class: Postscript::Model::Operators::Stack::Index
- Inherits:
-
Postscript::Model::Operator
- Object
- Postscript::Model::Operator
- Postscript::Model::Operators::Stack::Index
- Defined in:
- lib/postscript/model/operators/stack.rb
Instance Attribute Summary collapse
-
#index ⇒ Object
readonly
Returns the value of attribute index.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(index:) ⇒ Index
constructor
A new instance of Index.
Methods inherited from Postscript::Model::Operator
#accept, #operator?, register_as
Constructor Details
#initialize(index:) ⇒ Index
Returns a new instance of Index.
38 39 40 41 |
# File 'lib/postscript/model/operators/stack.rb', line 38 def initialize(index:) @index = index freeze end |
Instance Attribute Details
#index ⇒ Object (readonly)
Returns the value of attribute index.
37 38 39 |
# File 'lib/postscript/model/operators/stack.rb', line 37 def index @index end |
Class Method Details
.from_operands(stack) ⇒ Object
42 43 44 |
# File 'lib/postscript/model/operators/stack.rb', line 42 def self.from_operands(stack) new(index: stack.pop_number.to_i) end |