Class: Peddler::StructuredList Private
- Inherits:
-
Object
- Object
- Peddler::StructuredList
- 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
- #build(vals) ⇒ Object private
-
#initialize(*keys) ⇒ StructuredList
constructor
private
A new instance of StructuredList.
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.
6 7 8 |
# File 'lib/peddler/structured_list.rb', line 6 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.
10 11 12 13 14 15 |
# File 'lib/peddler/structured_list.rb', line 10 def build(vals) Array(vals) .flatten .each_with_index .reduce({}) { |hsh, (v, i)| hsh.merge(compose_key(i + 1) => v) } end |