Module: TimeCrisis::DateRange::Date::InstanceMethods
- Defined in:
- lib/time_crisis/date_range.rb
Instance Method Summary collapse
- #for(unit, scale) ⇒ Object
- #from(unit, scale) ⇒ Object
- #range(unit = 1, scale = 'years', direction = 'past') ⇒ Object
Instance Method Details
#for(unit, scale) ⇒ Object
84 85 86 |
# File 'lib/time_crisis/date_range.rb', line 84 def for(unit, scale) self.range(unit, scale, 'future') end |
#from(unit, scale) ⇒ Object
80 81 82 |
# File 'lib/time_crisis/date_range.rb', line 80 def from(unit, scale) self.range(unit, scale, 'past') end |
#range(unit = 1, scale = 'years', direction = 'past') ⇒ Object
88 89 90 91 |
# File 'lib/time_crisis/date_range.rb', line 88 def range(unit=1, scale='years', direction='past') selfkey = direction == 'past' ? :end : :begin self.class.range({selfkey => self, :unit => unit, :scale => scale}) end |