From: Caleb Clausen Date: 2009-05-02T01:52:29+09:00 Subject: Re: Finding Matches in Array of Classes Joel's select/include? implementation is the normal way to solve this particular problem, but if you're looking for a more general approach to dealing with arrays and other ruby data structures, you might look at Reg, my declarative language for matching ruby data structures. With Reg, I would use this variation on Joel's code: require 'rubygems' require 'reg' require 'time' range = Time.parse("2008-1-1")...Time.parse("2009-1-1") #results.select {|r| range.include? r.observation_time} results.grep -{:observation_time=>range} For most things Reg can do, it's syntax is shorter than the equivalent imperative form, but it's not so big in simple cases like this. http://rubyforge.org/projects/reg/ http://github.com/coatl/reg/