openhab-scripting 3.7.2 → 3.8.1

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: 174f628c9e67a6433363e1b5c445cacbd7871bb44656036aabdea51a8b107bc2
4
- data.tar.gz: 3b4ddee8956cbf8c9168bb2c7cc6987d5884af317d5cc4e73746b66c81819506
3
+ metadata.gz: 03f4915cdcccdf7e6d5f509d93cfba5daae5ca85c9e355413d2d78f270bb9584
4
+ data.tar.gz: f2d8b6ac6296a51dbf27d0047095397817a479cf3af16661d4fbf9c73d74911d
5
5
  SHA512:
6
- metadata.gz: 6f4034acdeddbb470233ce3a93c016b8ba1399119141be52cf9eaf3740f373164e06606bdce62e42004bd43e759153b06e7e1570e877aaa812f3c57b55018306
7
- data.tar.gz: 4247035dabf9588f3a7fa0cbc9f15c9670b5bb32a2ea9be4caa92b95eed108ea105f6105c44c5afd6b5872e3070248be2c781855d0538051258da04649b55938
6
+ metadata.gz: 1ae48d6b88bfcb037a90e6531fe5dca9da08139337d153ec64eae50bd75ec594eaddd2b87344e97cdd1d3f65a415a89e98c2b87dc1149fa56d8b5720619a120d
7
+ data.tar.gz: 37b692b154064290cb16203313652efff3e93358f74b4de71fc3b4ef51b1633dd4711f05f46b86d0588b17683e3bef68784aca9299017368ebac0b920c6d2c60
@@ -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.2'
8
+ VERSION = '3.8.1'
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openhab-scripting
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.2
4
+ version: 3.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian O'Connell
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-09-14 00:00:00.000000000 Z
11
+ date: 2021-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler