params = {:a => "a", :b => "thisisb", :c => "c", :d => "thiswasb", :e => "34" }
foo params.select{|k| [:a, :b, :c].include?(k)}

Ruby On Passing hashed arguments

by Sam Warmuth, May 28, 2010 05:47 Star_fullStar_fullStar_fullStar_fullStar_full

I'm surprised no one used s...

Cb9b01bd3f65603f3314b71b868a3703 Talk
params = {:a => "a", :b => "thisisb", :c => "c", :d => "thiswasb", :e => "34" }

foo(params.select{|k| (:a..:c).include?(k)})

Ruby On Passing hashed arguments

by Sam Warmuth, May 28, 2010 04:15

Or, if you're golfing...

Cb9b01bd3f65603f3314b71b868a3703 Talk
params = {:a => "a", :b => "thisisb", :c => "c", :d => "thiswasb", :e => "34" }
save = [:a, :b, :c]

...

Ruby On Passing hashed arguments

by Sam Warmuth, May 28, 2010 04:09

Simpler.

Cb9b01bd3f65603f3314b71b868a3703 Talk