time_pieces 1.0.1 → 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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/time_pieces/duration.rb +5 -0
- data/lib/time_pieces/version.rb +1 -1
- metadata +2 -3
- data/pkg/time_pieces-1.0.0.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f7098f2d181bb8ebcfc57c72bf7048b173fdd43
|
4
|
+
data.tar.gz: c93566156f61614497bd3bff156f6f96b079464d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7b5b6780294f08ba9172072da1de6f0f0564657fb624bea4754c852920a7046538c2b5d9a90de88c91a95276fffdc195f996fa969389ca4488fb2d1b2df2173
|
7
|
+
data.tar.gz: 83d42224dd9bc7eaf8d20df5529d19879d85cc360a1f5c437a683f1b16bc5065309636bd6264ecd1e8b167c9378a62b8b4bea89c3f1ad7f6793c48be27913e77
|
data/Gemfile.lock
CHANGED
data/lib/time_pieces/duration.rb
CHANGED
@@ -32,6 +32,9 @@ module TimePieces
|
|
32
32
|
return true if (other_td.end_at_seconds > start_at_seconds) && (other_td.end_at_seconds <= end_at_seconds) && (other_td.start_at_seconds >= start_at_seconds) && (other_td.start_at_seconds < end_at_seconds)
|
33
33
|
return false
|
34
34
|
end
|
35
|
+
def inside_of?(other_td)
|
36
|
+
return true if (other_td.start_at_seconds < start_at_seconds) && (other_td.end_at_seconds > end_at_seconds)
|
37
|
+
end
|
35
38
|
def overlaps_outside?(other_td)
|
36
39
|
return other_td.overlaps_inside?(self)
|
37
40
|
end
|
@@ -99,11 +102,13 @@ module TimePieces
|
|
99
102
|
end
|
100
103
|
def -(other_td)
|
101
104
|
ts_ret = TimeSet.new
|
105
|
+
return ts_ret if inside_of?(other_td)
|
102
106
|
unless overlaps?(other_td)
|
103
107
|
ts_ret << self
|
104
108
|
return ts_ret
|
105
109
|
end
|
106
110
|
if overlaps?(other_td)
|
111
|
+
|
107
112
|
if overlaps_start?(other_td)
|
108
113
|
update_start_seconds_and_end_seconds(other_td.end_at_seconds, end_at_seconds)
|
109
114
|
ts_ret << self
|
data/lib/time_pieces/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: time_pieces
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Grant R.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -83,7 +83,6 @@ files:
|
|
83
83
|
- lib/time_pieces/simple_duration.rb
|
84
84
|
- lib/time_pieces/time_set.rb
|
85
85
|
- lib/time_pieces/version.rb
|
86
|
-
- pkg/time_pieces-1.0.0.gem
|
87
86
|
- time_pieces.gemspec
|
88
87
|
homepage: http://github.com/riggleg/time_pieces
|
89
88
|
licenses:
|
data/pkg/time_pieces-1.0.0.gem
DELETED
Binary file
|