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