Method: OFlow::Box#set

Defined in:
lib/oflow/box.rb

#set(path, value) ⇒ Object

Sets or adds a value inside the Box. The Box is changed with the new contents being thawed where necessary. A path is a set of element names in the case of a Hash or index numbers in the case of an Array joined with the ‘:’ character as a separator.

Parameters:

  • path (String)

    location of element to change or add.

  • value

    value for the addition or change



44
45
46
47
# File 'lib/oflow/box.rb', line 44

def set(path, value)
  return aset(nil, value) if path.nil?
  aset(path.split(':'), value)
end