hour-ruby 0.0.3 → 0.0.4
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/lib/hour.rb +15 -0
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc01dd18ded1207c7b8983eb21f9ef335318760adfc8629ac21231666015b4d0
|
4
|
+
data.tar.gz: 1d992b5f668e305cbf50f26142c1ea52d1183ca459686ff6c2d2c426497d52ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e19b77cd897cbf3800e87d92ff3d67c8bb796aa0e52abf37f3d272b893ef00d13e7137a9738589cd4a5c60147850a17b96aa5e99137e7ed3d70a49d2bcce0f84
|
7
|
+
data.tar.gz: f661487e9153b7d90c8e6380f447bd1f8c42088010cc8f2a51be58bfa0881a393443609e46883f34be9a655b82a67f2ba219c573633014aa0c390755dc6bdd43
|
data/lib/hour.rb
CHANGED
@@ -144,6 +144,21 @@ class Hour
|
|
144
144
|
self.class.new(hours, minutes, seconds)
|
145
145
|
end
|
146
146
|
|
147
|
+
def -(other)
|
148
|
+
hours = @h - other.h - (@m - other.m - ((@s - other.s) / 60)) / 60
|
149
|
+
minutes = (@m - other.m - ((@s - other.s) / 60)) % 60
|
150
|
+
|
151
|
+
if @s && other.s
|
152
|
+
seconds = (@s - other.s) % 60
|
153
|
+
elsif (!@s) && (!other.s)
|
154
|
+
seconds = false
|
155
|
+
else
|
156
|
+
raise "TODO: how to resolve this?"
|
157
|
+
end
|
158
|
+
|
159
|
+
self.class.new(hours, minutes, seconds)
|
160
|
+
end
|
161
|
+
|
147
162
|
# Returns a decorator providing convenience methods for working with hours.
|
148
163
|
#
|
149
164
|
# Hour.new(1, 25).hours.round # => 1
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hour-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James C Russell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: "."
|
14
14
|
email: james@101ideas.cz
|
@@ -39,8 +39,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
requirements: []
|
42
|
-
|
43
|
-
rubygems_version: 2.7.6
|
42
|
+
rubygems_version: 3.0.3
|
44
43
|
signing_key:
|
45
44
|
specification_version: 4
|
46
45
|
summary: ''
|