@jdezenzio: "I have an array that contains 36 objects.  The composition of those
objects includes a date, a team, and a time.  It is being parsed from
another site.
[0] = Sept 2
[1] = vsSouthern Miss
[2] = 7:30 PM ET
[3] = Sept 9
[4] = @Florida
[5] = 7:30 PM ET
etc.
Every 3 objects should be combined into a specific hash row.
[0][:date] = Sept 2
[0][:team] = vsSouthern Miss
[0][:time] = 7:30 PM ET
[1][:date] = Sept 9
[1][:team] = @Florida
[1][:time] = 7:30 PM ET
etc.
I'm having trouble accomplishing this.  Each schedule might have more
than 36 objects in the array, but the divisor will always be 3 in terms
of what type of information is presented.  So, a team might have an
array of 39 objects or 42 objects but in the end, the objects are a
date, team, and a time.
I've tried numerous things, even adding a new class method:
class Array
  def to_spec_hash(other)
    Hash[ *(0...self.size()).inject([]) { |arr, ix| arr.push(self[ix],
other[ix]) } ]
  end
end
and then trying to use:
%W{ date team time }.to_spec_hash( %W{ value1 value2 value3 etc. } )
but I'd have to iterate over date team and time according to how many
rows of data divided by 3 would be and the same for the values.  Again,
I know it's sloppy.
I'm sure there's a much faster and a cleaner way of accomplishing this
but I'm lacking sleep and therefore not thinking as clearly.
Any help would be appreciated.
Posted via <url>"
    @rickdenatale: "<quote>
Is this what you want?
input =3D [
  "Sept 2",
  "vsSouthern Miss",
  "7:30 PM ET"     ,
  "Sept 9"         ,
  "@Florida"       ,
  "7:30 PM ET"
]
input.extend Enumerable
p input.enum_for(:each_slice, 3).map { |date, team, time|
  {:date =3D> date, :team =3D> team, :time =3D> time}
}
[{:date=3D>"Sept 2", :team=3D>"vsSouthern Miss", :time=3D>"7:30 PM ET"},
{:date=3D>"Sept 9", :team=3D>"@Florida", :time=3D>"7:30 PM ET"}]
This is written for 1.8.6, for 1.8.7 or 1.9.x Enumerable is built in
in 1.9 and you can get the enumerator by calling each_slice without a
block.
p (input.each_slice(3)).map { |date, team, time|
  {:date =3D> date, :team =3D> team, :time =3D> time}
}
In any event if it were me I'd make a Game class, or at least use an
OpenStruct instead of a Hash
=20
Rick DeNatale
Blog: <url>
Github: <url>
Twitter: @RickDeNatale
WWR: <url>
LinkedIn: <url>"
    @jdezenzio: "Thanks Rick - this example did work but I believe your second idea was a 
better one.  I'll look into that instead.
Posted via <url>"
{'source': 'USENET', 'other_information': '{"reply_count": 2, "forum_name": "comp.lang.ruby.20141210.mbox"}', 'file': 'data/output/usenet-comp.lang.parquet'}