workhours 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a8c7f5dee953a61e1d670526c3088081f16f453c
4
- data.tar.gz: 74efe9fef0d7f6499bf3041bc8965aba35da3bd0
3
+ metadata.gz: 6d67eead1df1869383adbbfee6573fed2b608d90
4
+ data.tar.gz: 7a24c465191919e9565d5a65d43f7af9286ba565
5
5
  SHA512:
6
- metadata.gz: 8f138d644b682e8dc032de679f4742ac68764f0385fb24ce988b01d73b1c64a130164f37ab906eae55071e62a3bf605fc8ca052c59c44561e1ab38c058b1685f
7
- data.tar.gz: b8fb21d8d847938d684b5e918c6876de77e11bcd91fd8f5294580028f76207cc78c4df64f959dfd59782b88fb25131167e9396e3d62bef7a9ff6e19c26363f94
6
+ metadata.gz: e0afdb28e9b70515ba5492cbf7853bf510289d71dd119042166ee5289d5efc2b869833512d4ba505f67e61f603de1f05359784738553634d38c44257eb802de5
7
+ data.tar.gz: 1a53f9dc9acb22a73a2d5ad3b11d9e6d3e1f88c91efbeacabe79f609b6ddc232e115ad08391bd4d2242ea057902efcc8bb2bab19652efd91fdd0ad85cefabb59
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- workhours (0.2.0)
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.2)
12
+ json (1.8.3)
13
13
  rake (10.4.2)
14
- rspec (3.2.0)
15
- rspec-core (~> 3.2.0)
16
- rspec-expectations (~> 3.2.0)
17
- rspec-mocks (~> 3.2.0)
18
- rspec-core (3.2.3)
19
- rspec-support (~> 3.2.0)
20
- rspec-expectations (3.2.1)
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.2.0)
23
- rspec-mocks (3.2.1)
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.2.0)
26
- rspec-support (3.2.2)
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.3)
33
- tod (2.0.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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Workhours
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -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.0
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-05-05 00:00:00.000000000 Z
11
+ date: 2015-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tod