mirror of
https://github.com/czhu12/canine.git
synced 2025-12-20 18:29:53 -06:00
9 lines
225 B
Ruby
9 lines
225 B
Ruby
module DotSettable
|
|
def dotset(path, value)
|
|
keys = path.split(".")
|
|
last_key = keys.pop
|
|
nested_hash = keys.inject(self) { |current_hash, key| current_hash[key] ||= {} }
|
|
nested_hash[last_key] = value
|
|
end
|
|
end
|