Nice … well that works but in the constructor can you tell me
what “*” would literally “mean”?
I see you’ve already got this answer.
Does this just take only an Array obj or could you place any object
in there w/ public attributes/methods?
I’m not sure what “this” refers to in the above sentence. Try asking
your question again, please.
(Was this covered in pick-axe somewhere I missed?)
I just looked an can’t seem to find it. It’s the opposite of the *
operator described on page 347 (explodes an Array out, instead of
collecting it in).
h2 = Hash[*h1.select { |k, v| v == “bar2” }.flatten]
The “*” is sometimes called the “splat” operator. If you use the Hash
[] constructor and pass in an array with the * before it it will turn
the array into a hash using pairs of the array members to create the
key => values of the hash. Maybe a littel more code tells it best:
(Was this covered in pick-axe somewhere I missed?)
I just looked an can’t seem to find it. It’s the opposite of the *
operator described on page 347 (explodes an Array out, instead of
collecting it in).
Pickaxe 1, page 229, “Invoking a Method”. Online here: