class Burner::Library::Value::Copy

Copy one value in a register to another. Note that this does not perform any type of deep copy, it simply points one register's value to another. If you decide to later mutate one register then you may mutate the other.

Expected Payload input: anything. Payload output: whatever value was specified in the from_register.

Attributes

from_register[R]
to_register[R]

Public Class Methods

new(from_register: DEFAULT_REGISTER, name: '', to_register: DEFAULT_REGISTER) click to toggle source
Calls superclass method Burner::Job::new
# File lib/burner/library/value/copy.rb, line 22
def initialize(from_register: DEFAULT_REGISTER, name: '', to_register: DEFAULT_REGISTER)
  super(name: name)

  @from_register = from_register.to_s
  @to_register   = to_register.to_s

  freeze
end

Public Instance Methods

perform(output, payload) click to toggle source
# File lib/burner/library/value/copy.rb, line 31
def perform(output, payload)
  output.detail("Copying register: '#{from_register}' to: '#{to_register}'")

  payload[to_register] = payload[from_register]
end