schedular 0.1.11 → 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/schedular/locale/schedular.es.yml +1 -1
- data/lib/schedular/time.rb +4 -0
- data/test/test_event.rb +7 -3
- data/test/test_time.rb +4 -0
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.13
|
data/lib/schedular/time.rb
CHANGED
@@ -15,6 +15,10 @@ module Schedular
|
|
15
15
|
time = Range === time || DateTime === time ? time : (time..time+1)
|
16
16
|
{ :conditions => {:value => time} }
|
17
17
|
}
|
18
|
+
|
19
|
+
named_scope :order_by_closest_to, lambda { |date|
|
20
|
+
{:limit => count, :order => "ABS(strftime('%s', value) - strftime('%s', #{date.to_formatted_s :db})) desc"}
|
21
|
+
}
|
18
22
|
|
19
23
|
named_scope :all_day, lambda{ |bool| {:conditions => {'all_day' => (bool.nil? ? true : bool)} }}
|
20
24
|
|
data/test/test_event.rb
CHANGED
@@ -97,9 +97,13 @@ class Schedular::EventTest < Test::Unit::TestCase
|
|
97
97
|
assert_equal [@event3], Schedular::Event.by_params(:year => '2010', :month => '3', :day => '2')
|
98
98
|
end
|
99
99
|
|
100
|
-
|
101
|
-
|
102
|
-
|
100
|
+
should 'find by params with no year' do
|
101
|
+
assert_equal Schedular::Event.find(:all), Schedular::Event.by_params(:year => nil)
|
102
|
+
end
|
103
|
+
|
104
|
+
should 'find closest prior date' do
|
105
|
+
assert_equal Schedular::Time.by_time_or_period(Date.civil(2010, 1, -1)), Schedular::Event.closest_dates(Date.civil(2010, 3), 1)
|
106
|
+
end
|
103
107
|
end
|
104
108
|
|
105
109
|
should 'allways order times by value' do
|
data/test/test_time.rb
CHANGED
@@ -71,6 +71,10 @@ class Schedular::TimeTest < Test::Unit::TestCase
|
|
71
71
|
day = Date.civil(2010, 3, 2)
|
72
72
|
assert_equal Schedular::Time.by_time_or_period(day..day + 1), Schedular::Time.by_params(:year => '2010', :month => '3', :day => '2')
|
73
73
|
end
|
74
|
+
|
75
|
+
should 'find closest' do
|
76
|
+
assert_equal Schedular::Time.by_time_or_period(Date.civil(2010, 2, -1)), Schedular::Time.closest_to(Date.civil(2010, 3), 1)
|
77
|
+
end
|
74
78
|
end
|
75
79
|
|
76
80
|
should 'allways order by value' do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: schedular
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 13
|
10
|
+
version: 0.1.13
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Macario Ortega
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-10-
|
18
|
+
date: 2010-10-26 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|