ranged_find 0.1 → 0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/dreamer3/ranged_find.rb +3 -3
- metadata +3 -3
data/lib/dreamer3/ranged_find.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Dreamer3 # :nodoc:
|
2
2
|
module RangedFind # :nodoc:
|
3
3
|
|
4
|
-
DATE_RANGES={
|
4
|
+
DATE_RANGES= lambda {{
|
5
5
|
# daily
|
6
6
|
:yesterday => [ Time.zone.now.yesterday.midnight, 1.day ],
|
7
7
|
:today => [ Time.zone.now.midnight, 1.day ],
|
@@ -14,7 +14,7 @@ module Dreamer3 # :nodoc:
|
|
14
14
|
:last_month => [ Time.zone.now.prev_month.beginning_of_month, 1.month ],
|
15
15
|
:this_month => [ Time.zone.now.beginning_of_month, 1.month ],
|
16
16
|
:next_month => [ Time.zone.now.next_month.beginning_of_month, 1.month ],
|
17
|
-
}
|
17
|
+
}}
|
18
18
|
|
19
19
|
module ClassMethods
|
20
20
|
|
@@ -32,7 +32,7 @@ module Dreamer3 # :nodoc:
|
|
32
32
|
if time_range.is_a?(Range)
|
33
33
|
conditions << time_range.begin
|
34
34
|
conditions << time_range.end
|
35
|
-
elsif range=DATE_RANGES[time_range]
|
35
|
+
elsif range=DATE_RANGES.call[time_range]
|
36
36
|
conditions << range.first
|
37
37
|
conditions << (range.last===Time ? range.last : range.first + range.last)
|
38
38
|
else
|
metadata
CHANGED