openhab-scripting 3.7.3 → 3.8.2

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
  SHA256:
3
- metadata.gz: e6257fbf175a31d70a87ef41e0e6d53002c1dec31bb12ee0dd63687d656258ad
4
- data.tar.gz: f4974c81d0035cc36b92e2b113ba1864eace902324ef6f4b5e7d4ecb4c02b1d8
3
+ metadata.gz: 6e5a2f4aad9380ac2a1d1d9acbed2916759e565e19fe3917808ea52639129b68
4
+ data.tar.gz: 160c5df3daaf6e6b034d7eabcb3caadfefa288c82d43332130edae7a70b08348
5
5
  SHA512:
6
- metadata.gz: 3c2e373ed6446e2964767b478653e314bd97b8f75621ba2a9716f0d6dedb5c1fb65505e016b764c84ee2d092530f9510e9d8ba94e6770bfc46198ef1c9b5ee3c
7
- data.tar.gz: 9c42e05c31c48ea52b996780a7e90b971848b0a6e81c51c8c477121addec8e45d9a275489e5e66aa6de7eca3533e8a7f35ce2bd5705bac17b341b49cfe8d1610
6
+ metadata.gz: e2775580d79a40bad1497eb9da0ec51fa5f62f19b2584be8a0691caad518c6d80c0db3b5f1e1a73ea157fa8ffaeee58dd1503e24dd2574d34162c2e918815434
7
+ data.tar.gz: e237f4309d21a9bef6f3f386c4ad4b3ccdc426e67019ede7a8bc28cacac7bc858b570af9a4fd0fa20eddf53da07ad12b4fd2b6ffe57a47d4093098da4b8040ea
@@ -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
- # Prepend Integer class with duration extensions
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)
@@ -5,5 +5,5 @@
5
5
  #
6
6
  module OpenHAB
7
7
  # @return [String] Version of OpenHAB helper libraries
8
- VERSION = '3.7.3'
8
+ VERSION = '3.8.2'
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openhab-scripting
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.3
4
+ version: 3.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian O'Connell