Sha256: fe52ce7e9b6b68b83d6488b92f4b7e31df2e4b75d43aa43e7e2becfbb8f92e02
Contents?: true
Size: 349 Bytes
Versions: 12
Compression:
Stored size: 349 Bytes
Contents
module Peddler # @api private class StructuredList def initialize(*keys) @keys = keys end def build(vals) Array(vals) .each_with_index .reduce({}) { |hsh, (v, i)| hsh.merge(compose_key(i + 1) => v) } end private def compose_key(index) (@keys.dup << index).join('.') end end end
Version data entries
12 entries across 12 versions & 1 rubygems