Class: Postscript::Model::Operators::Container::Put

Inherits:
Postscript::Model::Operator show all
Defined in:
lib/postscript/model/operators/container.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Postscript::Model::Operator

#accept, #operator?, register_as

Constructor Details

#initialize(operand:, key:, value:) ⇒ Put

Returns a new instance of Put.



37
38
39
40
41
42
# File 'lib/postscript/model/operators/container.rb', line 37

def initialize(operand:, key:, value:)
  @operand = operand
  @key = key
  @value = value
  freeze
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



36
37
38
# File 'lib/postscript/model/operators/container.rb', line 36

def key
  @key
end

#operandObject (readonly)

Returns the value of attribute operand.



36
37
38
# File 'lib/postscript/model/operators/container.rb', line 36

def operand
  @operand
end

#valueObject (readonly)

Returns the value of attribute value.



36
37
38
# File 'lib/postscript/model/operators/container.rb', line 36

def value
  @value
end

Class Method Details

.from_operands(stack) ⇒ Object



43
44
45
46
47
48
# File 'lib/postscript/model/operators/container.rb', line 43

def self.from_operands(stack)
  value = stack.pop
  key = stack.pop
  coll = stack.pop
  new(operand: coll, key: key, value: value)
end