mmb-seasonal 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/seasonal.rb +1 -13
- data/seasonal.gemspec +2 -2
- data/test/seasonal_test.rb +0 -15
- metadata +2 -2
data/lib/seasonal.rb
CHANGED
@@ -30,22 +30,10 @@ module Seasonal
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
def has_year(s)
|
34
|
-
p = Time.parse(s)
|
35
|
-
p.eql?(Time.parse(s + ' ' + (p.year + 1).to_s))
|
36
|
-
end
|
37
|
-
|
38
33
|
def end_utc
|
39
34
|
unless ennd.nil?
|
40
35
|
tz = TZInfo::Timezone.get(zone)
|
41
|
-
|
42
|
-
# if no year is given for end and it falls before start, assume they
|
43
|
-
# meant next year
|
44
|
-
if !start.nil? and (result < start_utc) and !has_year(ennd)
|
45
|
-
result = Time.utc(result.year + 1, result.month, result.day,
|
46
|
-
result.hour, result.min, result.sec, result.usec)
|
47
|
-
end
|
48
|
-
result
|
36
|
+
tz.local_to_utc(Time.parse(ennd))
|
49
37
|
end
|
50
38
|
end
|
51
39
|
|
data/seasonal.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "seasonal"
|
3
|
-
s.version = "0.0.
|
4
|
-
s.date = "2009-01-
|
3
|
+
s.version = "0.0.6"
|
4
|
+
s.date = "2009-01-14"
|
5
5
|
s.summary = "create logic based on defined date and time events"
|
6
6
|
s.email = "matthewm@boedicker.org"
|
7
7
|
s.homepage = "http://github.com/mmb/seasonal"
|
data/test/seasonal_test.rb
CHANGED
@@ -48,21 +48,6 @@ class SeasonalTest < Test::Unit::TestCase
|
|
48
48
|
assert_equal(false, e.going_on?(ennd + 1))
|
49
49
|
end
|
50
50
|
|
51
|
-
def test_event_start_end_crosses_year_boundary
|
52
|
-
ss = 'dec 31'
|
53
|
-
es = 'jan 1'
|
54
|
-
start = Time.parse(ss).utc
|
55
|
-
ennd = Time.parse(es).utc
|
56
|
-
ennd = Time.utc(ennd.year + 1, ennd.month, ennd.day, ennd.hour, ennd.min,
|
57
|
-
ennd.sec, ennd.usec)
|
58
|
-
|
59
|
-
e = Seasonal::Event.new(nil, 'America/New_York', :start => ss, :end => es)
|
60
|
-
assert_equal(false, e.going_on?(start - 1))
|
61
|
-
assert(e.going_on?(start))
|
62
|
-
assert(e.going_on?(ennd))
|
63
|
-
assert_equal(false, e.going_on?(ennd + 1))
|
64
|
-
end
|
65
|
-
|
66
51
|
def test_calendar_going_on
|
67
52
|
calendar = Seasonal::Calendar.new
|
68
53
|
calendar.push(Seasonal::Event.new(nil, 'America/New_York',
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mmb-seasonal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew M. Boedicker
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-01-
|
12
|
+
date: 2009-01-14 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|