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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 152174c3766a83b620a0ec7df6e692bb914e187c788d9c5eecfcedd42bfd641c
4
- data.tar.gz: 44084d3557abd293faf97858470414cf5f3dd65e07faa8f74e8f40e0d6ea8edb
3
+ metadata.gz: e405e19fe5977dfbe708699abaf9fe3e0e953d2d16450da5b10879b6e0d3494b
4
+ data.tar.gz: c1ed131f668cd5e214f56164ff10a3e9938df4aaa5f6a55efde4ba23db164f82
5
5
  SHA512:
6
- metadata.gz: 617deb9b4f75a92a407cf8db6ff695f409ac5f006690751c10100919d414851dc83758ec0560badf3d40097cc896d86de132a215d22a3f505b8e97bff26a8ad2
7
- data.tar.gz: 5a2c037047ce9db79d57a153e5df94c631144d511ac716b1862a8a6c4fc567d01c6efa15d93583f2bc80a792c47c85e30dda65ec481a1f14f6a588765638d56f
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[+ - * / % | to_d to_f to_i to_int] => :state
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
  #
@@ -5,5 +5,5 @@
5
5
  #
6
6
  module OpenHAB
7
7
  # @return [String] Version of OpenHAB helper libraries
8
- VERSION = '4.37.0'
8
+ VERSION = '4.37.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: 4.37.0
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-08 00:00:00.000000000 Z
11
+ date: 2022-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler