Module: TimeCrisis::DateRange::Date::InstanceMethods

Defined in:
lib/time_crisis/date_range.rb

Instance Method Summary collapse

Instance Method Details

#for(unit, scale) ⇒ Object



102
103
104
# File 'lib/time_crisis/date_range.rb', line 102

def for(unit, scale)
  self.range(unit, scale, 'future')
end

#from(unit, scale) ⇒ Object



98
99
100
# File 'lib/time_crisis/date_range.rb', line 98

def from(unit, scale)
  self.range(unit, scale, 'past')
end

#range(unit = 1, scale = 'years', direction = 'past') ⇒ Object



106
107
108
109
# File 'lib/time_crisis/date_range.rb', line 106

def range(unit=1, scale='years', direction='past')
  selfkey = direction == 'past' ? :end : :begin
  self.class.range({selfkey => self, :unit => unit, :scale => scale})
end