On Tue, Jun 30, 2009 at 3:57 AM, Colin Law<[email protected]> wrote: > > 2009/6/29 Rob Biedenharn <[email protected]>: >> ... >> This will get everything up to 4:59. If you want 12:00am (00:00) to >> 4:00am (04:00) inclusive, you want something like >> >> (0...4).include?(current_time.hour) || >> (current_time.hour == 4 && >> current_time.minute == 0 && >> current_time.second == 0) >> >> Note that (x...y).include?(z) is equivalent to: >> (x <= z && z < y) > > That is not correct is it? I thought the default on a Range is to > include the limits so it would be > x<=z && z<=y > If I am right then you would need (0..3).include? in the above code.
No, that's the difference between a two dot and a three dot range (a..b) includes b, (a...b) does not. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

