From: Alain m. Lafon [mailto:preek.aml / gmail.com] 
# is there a way to include conditionals in something like:
#    g.labels = Hash[*invoice.collect {|v| [v["Scandate"].to_s,
# "1"]}.flatten]
# In this example I don't want to include entries to the hash where
# v["Scandate"] is an empty string.

you'll have to make two passes (wish there was a reject/select+map combi)

sample, (note untested, i just type it in this email :)

  g.labels = Hash[*invoice.reject{|v| [v["Scandate"]. to_s.strip. empty?}. collect{|v| [v["Scandate"].to_s, "1"]}.flatten]