openhab-scripting 3.7.4 → 3.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/openhab/dsl/monkey_patch/ruby/number.rb +50 -6
- data/lib/openhab/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2e80835051d7ae6fbf6cc1e49ffc078e207e5a8efd94227aa04cf5cad8be328
|
4
|
+
data.tar.gz: b01cff4cf5ac8aeee71d9433822c49742c8af721d01d3103cfe686a990b0ba0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c359c7269873ee64363cefdbccce0f89972fb916544764eba8fa92863707b74f824189783b23acba7032fcfae14fe9da7c92bb1e7195ae16ea8d8f28b4864844
|
7
|
+
data.tar.gz: 997a8d7daf80eddfb122bf22206fd071e548ad84570008990b56709dd365e6b3cfbb9ecfd280118ef6d6b2f1be2ae482ab3521ed9e211dace3c5ef3868b1cc98
|
@@ -26,14 +26,58 @@ module OpenHAB
|
|
26
26
|
alias minute minutes
|
27
27
|
alias hour hours
|
28
28
|
end
|
29
|
+
|
30
|
+
#
|
31
|
+
# Extend float to create duration object
|
32
|
+
#
|
33
|
+
module FloatExtensions
|
34
|
+
#
|
35
|
+
# Create Duration with number of milliseconds
|
36
|
+
#
|
37
|
+
# @return [Java::JavaTime::Duration] Duration truncated to an integral number of milliseconds from self
|
38
|
+
#
|
39
|
+
def millis
|
40
|
+
Java::JavaTime::Duration.of_millis(to_i)
|
41
|
+
end
|
42
|
+
|
43
|
+
#
|
44
|
+
# Create Duration with number of seconds
|
45
|
+
#
|
46
|
+
# @return [Java::JavaTime::Duration] Duration with number of seconds from self
|
47
|
+
#
|
48
|
+
def seconds
|
49
|
+
(self * 1000).millis
|
50
|
+
end
|
51
|
+
|
52
|
+
#
|
53
|
+
# Create Duration with number of minutes
|
54
|
+
#
|
55
|
+
# @return [Java::JavaTime::Duration] Duration with number of minutes from self
|
56
|
+
#
|
57
|
+
def minutes
|
58
|
+
(self * 60).seconds
|
59
|
+
end
|
60
|
+
|
61
|
+
#
|
62
|
+
# Create Duration with number of hours
|
63
|
+
#
|
64
|
+
# @return [Java::JavaTime::Duration] Duration with number of hours from self
|
65
|
+
#
|
66
|
+
def hours
|
67
|
+
(self * 60).minutes
|
68
|
+
end
|
69
|
+
|
70
|
+
alias second seconds
|
71
|
+
alias millisecond millis
|
72
|
+
alias milliseconds millis
|
73
|
+
alias ms millis
|
74
|
+
alias minute minutes
|
75
|
+
alias hour hours
|
76
|
+
end
|
29
77
|
end
|
30
78
|
end
|
31
79
|
end
|
32
80
|
end
|
33
81
|
|
34
|
-
|
35
|
-
|
36
|
-
#
|
37
|
-
class Integer
|
38
|
-
prepend OpenHAB::DSL::MonkeyPatch::Ruby::IntegerExtensions
|
39
|
-
end
|
82
|
+
Integer.prepend(OpenHAB::DSL::MonkeyPatch::Ruby::IntegerExtensions)
|
83
|
+
Float.prepend(OpenHAB::DSL::MonkeyPatch::Ruby::FloatExtensions)
|
data/lib/openhab/version.rb
CHANGED