Module: DateScope::Intervals

Defined in:
lib/datescope/intervals.rb

Class Method Summary collapse

Class Method Details

.allObject



28
29
30
# File 'lib/datescope/intervals.rb', line 28

def self.all
  {:start => Time.at(0), :end => Time.at(2**31-1), :type => "all"}
end

.last_monthObject



20
21
22
# File 'lib/datescope/intervals.rb', line 20

def self.last_month
  {:start => 1.month.ago.beginning_of_month, :end => 1.month.ago.end_of_month, :type => "month"}
end

.month_before_last_monthObject



24
25
26
# File 'lib/datescope/intervals.rb', line 24

def self.month_before_last_month
  {:start => 2.month.ago.beginning_of_month, :end => 2.month.ago.end_of_month, :type => "month"}
end

.this_monthObject



12
13
14
# File 'lib/datescope/intervals.rb', line 12

def self.this_month
  {:start => 0.month.ago.beginning_of_month, :end => 0.month.ago.end_of_month, :type => "month"}
end

.this_weekObject



8
9
10
# File 'lib/datescope/intervals.rb', line 8

def self.this_week
  {:start => 0.week.ago.beginning_of_week, :end => 0.week.ago.end_of_week, :type => "week"}
end

.this_yearObject



16
17
18
# File 'lib/datescope/intervals.rb', line 16

def self.this_year
  {:start => 0.year.ago.beginning_of_year, :end => 0.year.ago.end_of_year, :type => "year"}
end

.todayObject



4
5
6
# File 'lib/datescope/intervals.rb', line 4

def self.today
  {:start => 0.day.ago.beginning_of_day, :end => 0.day.ago.end_of_day, :type => "day"}
end