Hello, this is my first (very tiny) attempt to get involved.

My thought is to supplement the #since / #ago family with methods that 
return a Range. Durations and dates/times could each get three methods: one 
for the future, one for the past, and one for both:
2.weeks.following 1.year.ago
2.weeks.preceding 1.year.ago
2.weeks.surrounding 1.year.ago
1.year.ago.and_the_following weeks: 2
1.year.ago.and_the_preceding weeks: 2
1.year.ago.and_the_surrounding weeks: 2

Also, infinite ranges will someday be universal. Currently endless (min..) 
are in 2.6, and beginless (..max) are in development. The following 
no-argument form will then be possible:
case updated_at
when 10.years.ago.and_the_preceding then #...
when 1.year.ago.and_the_preceding then #...
when 1.month.ago.and_the_preceding then #...

Obviously implementing this is trivial since they'd just use #since/#ago 
for durations and #advance for times/dates. So do people want these 
methods? How frequently do you use time ranges?

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-core+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-core@googlegroups.com.
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Reply via email to