Sha256: be8be71c7a8fd550fdadcd996e13200e9e5e3d7984ab4f1ae6e6822d5920560c
Contents?: true
Size: 367 Bytes
Versions: 41
Compression:
Stored size: 367 Bytes
Contents
module Doing ## ## Array helpers ## module ArrayNestedHash ## ## Convert array to nested hash, setting last key to value ## ## @param value The value to set ## def nested_hash(value = nil) hsh = Hash.new { |h, k| h[k] = Hash.new(&h.default_proc) } hsh.dig(*self[0..-2])[fetch(-1)] = value hsh end end end
Version data entries
41 entries across 41 versions & 1 rubygems