Is this thing here a helper or a model, or something else?

I was thinking about this problem as it is very interesting to myself being a relatively new ruby/rails programmer. How about opening and extending the range method to handle stepping through DateTimes. Not sure how to do this, but heres the idea:

span = DateTime.parse("2011-01-13 12:00:00")...DateTime.parse("2011-01-13 12:15:00")

span.step(5.minutes) { |s| p s } # the 5.minutes is not right though

# perhaps a custom function then? span.step_every_five_minutes { |s| p s }

# This code to create the behavior would be placed in a patch file in lib/ lib/range_patch.rb

class Range ... end

Just brainstorming here : )

Jade

Hi all,

just in case you’re curious, I’ve implemented the functionality I needed as a tiny gem: https://github.com/ManuelKiessling/Timechunker

Regards,