duranged 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/duranged/base.rb +12 -0
- data/lib/duranged/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c23f324a8e86d2f5e42df7cb8c50a3904c94426
|
4
|
+
data.tar.gz: f6f8d5f74d185b9df4d106b7314bfe557b03500c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3dc3189de912615bf2c52ff4b30ead77597ef018e9ca538079d9ed2560705f1fb2827ea213ff2371e535fbe12b736218ac1aaa9446341c134e080f62c20e612d
|
7
|
+
data.tar.gz: 440b452fbdcd97aa51a1b195f1c5fac6e6d6ce26e7cedabc8799de6bcfe853774bc02773b1e757c31a5984daaa09c5a1d80afc452c737a0458cb41fe1f065524
|
data/lib/duranged/base.rb
CHANGED
@@ -48,10 +48,18 @@ module Duranged
|
|
48
48
|
self.class.new(to_i - other.to_i)
|
49
49
|
end
|
50
50
|
|
51
|
+
def round_to(period=:minutes)
|
52
|
+
dup.round_to!(period)
|
53
|
+
end
|
54
|
+
|
51
55
|
def round_to!(period=:minutes)
|
52
56
|
send("round_to_#{period}!")
|
53
57
|
end
|
54
58
|
|
59
|
+
def round_to_minutes
|
60
|
+
dup.round_to_minutes!
|
61
|
+
end
|
62
|
+
|
55
63
|
def round_to_minutes!
|
56
64
|
if seconds >= 30
|
57
65
|
@value = value + (60 - seconds)
|
@@ -60,6 +68,10 @@ module Duranged
|
|
60
68
|
end
|
61
69
|
end
|
62
70
|
|
71
|
+
def round_to_hours
|
72
|
+
dup.round_to_hours!
|
73
|
+
end
|
74
|
+
|
63
75
|
def round_to_hours!
|
64
76
|
round_to_minutes!
|
65
77
|
if minutes >= 30
|
data/lib/duranged/version.rb
CHANGED