Computer Science Canada formating / traversing hash |
| Author: | Tony [ Fri Oct 13, 2006 11:38 am ] | ||||||
| Post subject: | formating / traversing hash | ||||||
given a hash of keys => values, I want to construct a conditional statement that the hash describes, in the form "a = b AND c = d", etc. So far I've came up with
which seems like a pretty ugly solution. I especially don't like that last hack on a leftover "AND". Is there a more eligant approach? While #collect gives me a nice array
the #join acts as if the array was flattened
|
|||||||
| Author: | wtd [ Fri Oct 13, 2006 11:51 am ] |
| Post subject: | |
What happens if you pass a block to collect? |
|
| Author: | Tony [ Fri Oct 13, 2006 12:00 pm ] | ||
| Post subject: | |||
excellent question, thank you |
|||
| Author: | wtd [ Fri Oct 13, 2006 12:10 pm ] | ||||
| Post subject: | |||||
Tony wrote:
excellent question, thank you You're welcome, though I would have said:
|
|||||