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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6ac7aca706832922bfef7261701b9335a674c79023e06c59ee0a24345684ca3b
4
- data.tar.gz: 3029da6d4b5ec690d2b9f877f01e8094ff83f667a37a5adcd1fc2fe9130a8ba3
3
+ metadata.gz: b2e80835051d7ae6fbf6cc1e49ffc078e207e5a8efd94227aa04cf5cad8be328
4
+ data.tar.gz: b01cff4cf5ac8aeee71d9433822c49742c8af721d01d3103cfe686a990b0ba0b
5
5
  SHA512:
6
- metadata.gz: f2b0a210a7d362ea5ab903dcfa3afb8ca064ca4b656b452ba2db72619be986697cadef0ca7ea412ecc504bd36c198cb8bcddf3b88d27fbdac52f01367e9f537a
7
- data.tar.gz: fe03d7594d9bfe5a5e9db7c6c26a9c90238d66a2c14659319bcbc327b24cb2134bed21236a946f490d2aa16150d4ef7297512866414bb63ce65a68284c1af424
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.4'
8
+ VERSION = '3.8.0'
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.4
4
+ version: 3.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian O'Connell