openhab-scripting 2.14.0 → 2.14.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: 376e7ceca67ad5ca1dfedcacee9096e97819f3a382404ddde4f7beb579416e7d
4
- data.tar.gz: bdffa11dab63e1910d38a1232c38e2b9d64deaac1d8ea3610de464792d75173e
3
+ metadata.gz: 6851ec9dce8db775e48aaf7d08078281e2a2e9c1d6a2c2cd379de0d3fd2391f0
4
+ data.tar.gz: 2f656d9cb621d3826c72c2aa588d1ba478108bc30cffd32bf8e0e5fae85dbe47
5
5
  SHA512:
6
- metadata.gz: 712aa971a831d8b700ecbe23b429a083518deb3bf7c2b68aa91cc0f3e5253ac9a32087025994705b94d268db58ef73e27767dcb3ce182e4477bfa115c6c476e0
7
- data.tar.gz: e450d32857df9dd5aea47cc5e0baa7043e06901282324d2dfd4623cb2eac03c8fb60335e3de2e680911f1d4ad24095c2533fd3a9d5c90501694f849019e2d225
6
+ metadata.gz: 248767b8ec14f2f68412f152755beb872b15b6db26b363cc0837419e16f044b8c6b078843cd93c4efe8fe03358256df7cb8d390ebe43ddb6ad00b962ecb197ce
7
+ data.tar.gz: 9bb8e09d8a34c96b220b16b209c92cf5fce0f1bd54f28086ed3f6e4ae83ab24b0288bb828d9b2111fec3fbef10025b70624b13005140690ce5a9b2556df1a132
@@ -59,7 +59,7 @@ module OpenHAB
59
59
  if dimension
60
60
  [Quantity.new(other), to_qt]
61
61
  elsif @number_item.state?
62
- [BigDecimal(other), @number_item.state.to_big_decimal.to_d]
62
+ [other.to_d, @number_item.state.to_big_decimal.to_d]
63
63
  end
64
64
  else
65
65
  logger.trace("#{self} cannot be coereced to #{other.class}")
@@ -85,7 +85,7 @@ module OpenHAB
85
85
  @number_item.state <=> other.state
86
86
  end
87
87
  when Numeric
88
- @number_item.state.to_big_decimal.to_d <=> BigDecimal(other)
88
+ @number_item.state.to_big_decimal.to_d <=> other.to_d
89
89
  when String
90
90
  @number_item.state <=> QuantityType.new(other) if dimension
91
91
  end
@@ -199,7 +199,7 @@ module OpenHAB
199
199
  to_d.public_send(operation, other.to_d)
200
200
  end
201
201
  elsif other.is_a? Numeric
202
- to_d.public_send(operation, BigDecimal(other))
202
+ to_d.public_send(operation, other.to_d)
203
203
  elsif dimension && other.is_a?(String)
204
204
  to_qt.public_send(operation, Quantity.new(other))
205
205
  elsif other.respond_to? :coerce
@@ -3,3 +3,4 @@
3
3
  # Monkey patch ruby
4
4
  require 'openhab/core/dsl/monkey_patch/ruby/range'
5
5
  require 'openhab/core/dsl/monkey_patch/ruby/number'
6
+ require 'bigdecimal/util'
@@ -46,7 +46,7 @@ module OpenHAB
46
46
  when QuantityType
47
47
  quantity
48
48
  when Numeric
49
- QuantityType.new(BigDecimal(quantity).to_java, AbstractUnit::ONE)
49
+ QuantityType.new(quantity.to_d.to_java, AbstractUnit::ONE)
50
50
  else
51
51
  raise "Unexpected type #{quantity.class} provided to Quantity initializer"
52
52
  end
@@ -152,7 +152,7 @@ module OpenHAB
152
152
  logger.trace("Number Item coerced result a(#{a.class})='#{a}' b(#{b.class})='#{b}'")
153
153
  [a.quantity, b.quantity]
154
154
  when Numeric
155
- [quantity, QuantityType.new(BigDecimal(other).to_java, AbstractUnit::ONE)]
155
+ [quantity, QuantityType.new(other.to_d.to_java, AbstractUnit::ONE)]
156
156
  else
157
157
  raise TypeError,
158
158
  "Operation '#{operation}' cannot be performed between #{self} and #{other.class}"
@@ -5,5 +5,5 @@
5
5
  #
6
6
  module OpenHAB
7
7
  # @return [String] Version of OpenHAB helper libraries
8
- VERSION = '2.14.0'
8
+ VERSION = '2.14.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: 2.14.0
4
+ version: 2.14.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-02-03 00:00:00.000000000 Z
11
+ date: 2021-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler