openhab-scripting 4.37.0 → 4.37.1
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/items/numeric_item.rb +16 -1
- data/lib/openhab/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e405e19fe5977dfbe708699abaf9fe3e0e953d2d16450da5b10879b6e0d3494b
|
4
|
+
data.tar.gz: c1ed131f668cd5e214f56164ff10a3e9938df4aaa5f6a55efde4ba23db164f82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d970bd8b607aad49f59d0746ba56711dcf34a0c199547b76008e3e7f375b6836d06841c8cbdb86f056c4f58704690950583f20b76ae1e641515ea332f594f710
|
7
|
+
data.tar.gz: 7cbc491b62553a735e02f25f690a1244801fc2eac7d2a179dd1777d608a34752e5b549ecb41b73df6765c83ef717fe40d030414bb41291d1372872acaa89c9bb
|
@@ -19,11 +19,26 @@ module OpenHAB
|
|
19
19
|
def self.included(klass)
|
20
20
|
klass.prepend ItemEquality # make sure this is first
|
21
21
|
klass.extend Forwardable
|
22
|
-
klass.delegate %i[+ - * / %
|
22
|
+
klass.delegate %i[+ - * / % to_d to_f to_i to_int] => :state
|
23
23
|
# remove the JRuby default == so that we can inherit the Ruby method
|
24
24
|
klass.remove_method :==
|
25
25
|
end
|
26
26
|
|
27
|
+
#
|
28
|
+
# Convert state to a Quantity by calling state (DecimalType)#|
|
29
|
+
# Raise a NoMethodError if state is nil (NULL or UNDEF) instead of delegating to it.
|
30
|
+
# because nil#| would return true, causing an unexpected result
|
31
|
+
#
|
32
|
+
# @param [Unit, String] other the unit to convert to
|
33
|
+
#
|
34
|
+
# @return [QuantityType] the QuantityType in the given unit
|
35
|
+
#
|
36
|
+
def |(other)
|
37
|
+
raise NoMethodError, 'State is nil' unless state?
|
38
|
+
|
39
|
+
state.|(other)
|
40
|
+
end
|
41
|
+
|
27
42
|
#
|
28
43
|
# Check if NumericItem is truthy? as per defined by library
|
29
44
|
#
|
data/lib/openhab/version.rb
CHANGED
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: 4.37.
|
4
|
+
version: 4.37.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: 2022-04-
|
11
|
+
date: 2022-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|