openhab-scripting 3.7.1 → 3.8.0

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: ce4c09125467556cead8a8ddbe0e2d24c087dcb1166bcc25d5e3ba0feb453f73
4
- data.tar.gz: 9f06de9ff62504c2722d09d040d379e28dc2d8015e8191e1011825e48e6ef8a7
3
+ metadata.gz: b2e80835051d7ae6fbf6cc1e49ffc078e207e5a8efd94227aa04cf5cad8be328
4
+ data.tar.gz: b01cff4cf5ac8aeee71d9433822c49742c8af721d01d3103cfe686a990b0ba0b
5
5
  SHA512:
6
- metadata.gz: c0466716357e5c9d895dc097a7b93b5592c4c40940cdb373a412426698ca9b892546f04eb26ad702586109621b057383bea82accbf2e9cf9a19135f578fc2e2e
7
- data.tar.gz: 825609752e1294f3bc0fc03167307b52c6518a1745176d7bc7d61c916be5f1b5234b2c60342bf5603b6031241e65fcc9c4ba9f23d57e35327dc4b71583f650e9
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
- # 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.1'
8
+ VERSION = '3.8.0'
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.1
4
+ version: 3.8.0
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