Method: ActiveSet::AttributeInstruction#initialize

Defined in:
lib/active_set/attribute_instruction.rb

#initialize(keypath, value) ⇒ AttributeInstruction

Returns a new instance of AttributeInstruction.



8
9
10
11
12
13
14
# File 'lib/active_set/attribute_instruction.rb', line 8

def initialize(keypath, value)
  # `keypath` can be an Array (e.g. [:parent, :child, :grandchild, :attribute])
  # or a String (e.g. 'parent.child.grandchild.attribute')
  @keypath = Array(keypath).map(&:to_s).flat_map { |x| x.split('.') }
  @value = value
  @processed = false
end