On Tue, Jan 17, 2012 at 8:38 PM, Christopher Graves <gravescl / gmail.com> wrote:
> Thanks for pointing me in the right direction.
>
> I'll work on this when I get some more free time this afternoon. I'll
> get back to you guys for either some more help if I get stuck or for
> some code critique.

You can easily cook yourself a range which uses comparisons for matching:

irb(main):005:0> CompareRange = Struct.new :first, :last do
irb(main):006:1* def ===(x)
irb(main):007:2> x >= first && x < last
irb(main):008:2> end
irb(main):009:1> end
=> CompareRange
irb(main):010:0> r=CompareRange.new Time.now-10,Time.now+2
=> #<struct CompareRange first=2012-01-17 20:42:28 +0100,
last=2012-01-17 20:42:40 +0100>
irb(main):011:0> a=10.times.map {|i| r.first - 100 + i * 15}
=> [2012-01-17 20:40:48 +0100, 2012-01-17 20:41:03 +0100, 2012-01-17
20:41:18 +0100, 2012-01-17 20:41:33 +0100, 2012-01-17 20:41:48 +0100,
2012-01-17 20:42:03 +0100, 2012-01-17 20:42:18 +0100, 2012-01-17
20:42:33 +0100, 2012-01-17 20:42:48 +0100, 2012-01-17 20:43:03 +0100]
irb(main):012:0> a.grep r
=> [2012-01-17 20:42:33 +0100]

Note, this is simplistic but illustrates the idea.  You probably also
want to implement =~ operator.

Kind regards

robert


-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/