From: Pedro Silva Date: 2008-09-11T19:08:09+09:00 Subject: Re: Advanced conditionals H, > 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. The method collect/map has "friends". What you're looking for is select or reject. Select returns the elements from the container where the condition specified in the block evaluates to true, reject does the opposite - returns the elements that evaluate to false. Consider the following example: invoice = {:a => "a", :b => "b", :c => "", :d => "c", :e => ""} invoice.select { |a, b| b != "" } # [[:a, "a"], [:b, "b"], [:d, "c"]] Pedro Silva. -- Posted via http://www.ruby-forum.com/.