Class: Peddler::StructuredList Private

Inherits:
Object
  • Object
show all
Defined in:
lib/peddler/structured_list.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Constructor Details

#initialize(*keys) ⇒ StructuredList

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of StructuredList.



4
5
6
# File 'lib/peddler/structured_list.rb', line 4

def initialize(*keys)
  @keys = keys
end

Instance Method Details

#build(vals) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



8
9
10
11
12
13
14
# File 'lib/peddler/structured_list.rb', line 8

def build(vals)
  Array(vals)
    .each_with_index
    .reduce(Hash.new) { |hsh, (v, i)|
      hsh.merge(compose_key(i + 1) => v)
    }
end