workhours 0.2.0 → 0.2.1
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +18 -15
- data/lib/workhours/period.rb +5 -3
- data/lib/workhours/version.rb +1 -1
- data/spec/workhours_spec.rb +10 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6d67eead1df1869383adbbfee6573fed2b608d90
|
|
4
|
+
data.tar.gz: 7a24c465191919e9565d5a65d43f7af9286ba565
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e0afdb28e9b70515ba5492cbf7853bf510289d71dd119042166ee5289d5efc2b869833512d4ba505f67e61f603de1f05359784738553634d38c44257eb802de5
|
|
7
|
+
data.tar.gz: 1a53f9dc9acb22a73a2d5ad3b11d9e6d3e1f88c91efbeacabe79f609b6ddc232e115ad08391bd4d2242ea057902efcc8bb2bab19652efd91fdd0ad85cefabb59
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
workhours (0.2.
|
|
4
|
+
workhours (0.2.1)
|
|
5
5
|
tod (~> 2.0)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
@@ -9,28 +9,28 @@ GEM
|
|
|
9
9
|
specs:
|
|
10
10
|
diff-lcs (1.2.5)
|
|
11
11
|
docile (1.1.5)
|
|
12
|
-
json (1.8.
|
|
12
|
+
json (1.8.3)
|
|
13
13
|
rake (10.4.2)
|
|
14
|
-
rspec (3.
|
|
15
|
-
rspec-core (~> 3.
|
|
16
|
-
rspec-expectations (~> 3.
|
|
17
|
-
rspec-mocks (~> 3.
|
|
18
|
-
rspec-core (3.
|
|
19
|
-
rspec-support (~> 3.
|
|
20
|
-
rspec-expectations (3.
|
|
14
|
+
rspec (3.3.0)
|
|
15
|
+
rspec-core (~> 3.3.0)
|
|
16
|
+
rspec-expectations (~> 3.3.0)
|
|
17
|
+
rspec-mocks (~> 3.3.0)
|
|
18
|
+
rspec-core (3.3.1)
|
|
19
|
+
rspec-support (~> 3.3.0)
|
|
20
|
+
rspec-expectations (3.3.0)
|
|
21
21
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
22
|
-
rspec-support (~> 3.
|
|
23
|
-
rspec-mocks (3.
|
|
22
|
+
rspec-support (~> 3.3.0)
|
|
23
|
+
rspec-mocks (3.3.1)
|
|
24
24
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
25
|
-
rspec-support (~> 3.
|
|
26
|
-
rspec-support (3.
|
|
25
|
+
rspec-support (~> 3.3.0)
|
|
26
|
+
rspec-support (3.3.0)
|
|
27
27
|
simplecov (0.10.0)
|
|
28
28
|
docile (~> 1.1.0)
|
|
29
29
|
json (~> 1.8)
|
|
30
30
|
simplecov-html (~> 0.10.0)
|
|
31
31
|
simplecov-html (0.10.0)
|
|
32
|
-
timecop (0.7.
|
|
33
|
-
tod (2.0.
|
|
32
|
+
timecop (0.7.4)
|
|
33
|
+
tod (2.0.2)
|
|
34
34
|
|
|
35
35
|
PLATFORMS
|
|
36
36
|
ruby
|
|
@@ -42,3 +42,6 @@ DEPENDENCIES
|
|
|
42
42
|
simplecov
|
|
43
43
|
timecop
|
|
44
44
|
workhours!
|
|
45
|
+
|
|
46
|
+
BUNDLED WITH
|
|
47
|
+
1.10.5
|
data/lib/workhours/period.rb
CHANGED
|
@@ -68,12 +68,14 @@ module Workhours
|
|
|
68
68
|
def to_s
|
|
69
69
|
"#{wday} #{beginning.to_s}-#{ending.to_s}"
|
|
70
70
|
end
|
|
71
|
-
|
|
71
|
+
|
|
72
72
|
def overlaps?(other_day)
|
|
73
73
|
if wday != other_day.wday
|
|
74
|
-
return false
|
|
74
|
+
return false
|
|
75
75
|
end
|
|
76
|
-
|
|
76
|
+
|
|
77
|
+
return true if other_day.shift.beginning.second_of_day == 0 && other_day.shift.ending.second_of_day == 0
|
|
78
|
+
|
|
77
79
|
open_inside = beginning > other_day.beginning && beginning < other_day.ending
|
|
78
80
|
close_inside = ending > other_day.beginning && ending < other_day.ending
|
|
79
81
|
outside = beginning < other_day.beginning && ending > other_day.ending
|
data/lib/workhours/version.rb
CHANGED
data/spec/workhours_spec.rb
CHANGED
|
@@ -91,6 +91,15 @@ describe 'Workhours' do
|
|
|
91
91
|
week = Workhours::Week.new(hours: ['mon 15:00-16:00', 'mon 12:00-15:10'])
|
|
92
92
|
week.hours_overlap?.length.should eq(2)
|
|
93
93
|
week.hours_overlap?.should be_truthy
|
|
94
|
+
week = Workhours::Week.new(hours: ['mon 15:00-16:00', 'mon 00:00-00:00'])
|
|
95
|
+
week.hours_overlap?.length.should eq(2)
|
|
96
|
+
week.hours_overlap?.should be_truthy
|
|
97
|
+
week = Workhours::Week.new(hours: ['mon 00:00-00:00', 'mon 15:00-16:00'])
|
|
98
|
+
week.hours_overlap?.length.should eq(2)
|
|
99
|
+
week.hours_overlap?.should be_truthy
|
|
100
|
+
week = Workhours::Week.new(hours: ['mon 00:00-00:00', 'mon 00:00-00:00'])
|
|
101
|
+
week.hours_overlap?.length.should eq(2)
|
|
102
|
+
week.hours_overlap?.should be_truthy
|
|
94
103
|
|
|
95
104
|
week = Workhours::Week.new(hours: ['mon 12:00-15:00', 'mon 15:00-16:00'])
|
|
96
105
|
week.hours_overlap?.should eq(false)
|
|
@@ -259,6 +268,7 @@ describe 'Workhours' do
|
|
|
259
268
|
holidays: [],
|
|
260
269
|
week: %w(mon tue wed thu fri)
|
|
261
270
|
})
|
|
271
|
+
|
|
262
272
|
end
|
|
263
273
|
end
|
|
264
274
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: workhours
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- glebtv
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-
|
|
11
|
+
date: 2015-07-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: tod
|