Sha256: e10aea2e0a342f57c3af0cca291cc9e768ef8f3db8295f95d42f544d0ea00a3d
Contents?: true
Size: 358 Bytes
Versions: 14
Compression:
Stored size: 358 Bytes
Contents
module Doing ## ## Array helpers ## class ::Array ## ## 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
14 entries across 14 versions & 1 rubygems