lib/nrser/ext/tree/bury.rb
# The opposite of `#dig` - set a value at a deep key path, creating
# necessary structures along the way and optionally clobbering whatever is
# in the way to achieve success.
# 
# @param [Hash] hash
#   Hash to bury the value in.
# 
# @param [Array | #to_s] key_path
#   -   When an {Array}, each entry is used exactly as-is for each key.
#       
#   -   Otherwise, the `key_path` is converted to a string and split by
#       `.` to produce the key array, and the actual keys used depend on
#       the `parsed_key_type` option.
# 
# @param [Object] value
#   The value to set at the end of the path.
# 
# @param [Class | :guess] parsed_key_type
#   How to handle parsed key path segments:
#   
#   -   `String` - use the strings that naturally split from a parsed
#       key path.
#       
#       Note that this is the *String class itself, **not** a value that
#       is a String*.
#       
#   -   `Symbol` - convert the strings that are split from the key path
#       to symbols.
#       
#       Note that this is the *Symbol class itself, **not** a value that
#       is a Symbol*.``
#       
#   -   `:guess` (default) -
# 
# @return [return_type]
#   @todo Document return value.
# 
The opposite of `#dig` - set a value at a deep key path, creating
necessary structures along the way and optionally clobbering whatever is
in the way to achieve success.
The opposite of ` #dig ` - set a value at a deep key path creating necessary structures along the way and optionally clobbering whatever is in the way to achieve success .
def bury! key_path,
            value,
            parsed_key_type: :guess,
            clobber: false,
            create_arrays_for_unsigned_keys: false
    Tree.bury_in! \
      self,
      key_path,
      value,
      parsed_key_type: parsed_key_type,
      clobber: clobber,
      create_arrays_for_unsigned_keys: create_arrays_for_unsigned_keys
  end
def bury! key_path , value , parsed_key_type : :guess , clobber : false , create_arrays_for_unsigned_keys : false Tree . bury_in! self , key_path , value , parsed_key_type : parsed_key_type , clobber : clobber , create_arrays_for_unsigned_keys : create_arrays_for_unsigned_keys end
The opposite of `#dig` - set a value at a deep key path, creating
necessary structures along the way and optionally clobbering whatever is
in the way to achieve success.
The opposite of ` #dig ` - set a value at a deep key path creating necessary structures along the way and optionally clobbering whatever is in the way to achieve success .
@todo Document return value.
@todo Document return value .
return_type
key_path
<not_specific>
value
<not_specific>
parsed_key_type
<not_specific>
clobber
<not_specific>
create_arrays_for_unsigned_keys
<not_specific>
<not_specific>
parsed_key_type How to handle parsed key path segments: - `String` - use the strings that naturally split from a parsed key path. Note that this is the *String class itself, **not** a value that is a String*. - `Symbol` - convert the strings that are split from the key path to symbols. Note that this is the *Symbol class itself, **not** a value that is a Symbol*.`` - `:guess` (default)
parsed_key_type How to handle parsed key path segments : - ` String ` - use the strings that naturally split from a parsed key path . Note that this is the * String class itself ** not ** a value that is a String * . - ` Symbol ` - convert the strings that are split from the key path to symbols . Note that this is the * Symbol class itself ** not ** a value that is a Symbol * . ` ` - ` : guess ` ( default )