openhab-scripting 4.30.0 → 4.30.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/openhab/dsl/types/date_time_type.rb +2 -2
- data/lib/openhab/dsl/types/hsb_type.rb +2 -2
- data/lib/openhab/dsl/types/percent_type.rb +2 -2
- data/lib/openhab/dsl/types/point_type.rb +2 -2
- data/lib/openhab/dsl/types/quantity_type.rb +10 -10
- 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: 10d0c23c8f73defd79189dd05ec00cd3ce3aa301b87f6c7c8dbcfef3a73071d1
|
4
|
+
data.tar.gz: 45699ef1e370be135a4237eae154739f3375a95a9e5921ab97d1a51eb0ae87d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e711ed86c556564fb8265781893567ce842b4a920979825a9fda79a329855535745e30f9f95c2c2015e6b4caf38e303b616c665634bb55e144662f67f5a12a4
|
7
|
+
data.tar.gz: 7aa7ccb682c525857d0a9f39296c902f3b0396d7b19de5d76f5d06783daeb316be3f039f0c898301af69545849410a73be8b7261340154568062d71b6f30681b
|
@@ -10,8 +10,8 @@ module OpenHAB
|
|
10
10
|
DateTimeType = org.openhab.core.library.types.DateTimeType
|
11
11
|
java_import java.time.ZonedDateTime # This is needed for the addon prior to ruby_class fix (OH 3.2.0)
|
12
12
|
|
13
|
-
# global alias
|
14
|
-
::DateTimeType = DateTimeType
|
13
|
+
# global alias - required for jrubyscripting addon <= OH3.2.0
|
14
|
+
::DateTimeType = DateTimeType if ::DateTimeType.is_a?(Java::JavaLang::Class)
|
15
15
|
|
16
16
|
# @deprecated
|
17
17
|
# Backwards-compatible alias
|
@@ -8,8 +8,8 @@ module OpenHAB
|
|
8
8
|
module Types
|
9
9
|
HSBType = org.openhab.core.library.types.HSBType
|
10
10
|
|
11
|
-
# global alias
|
12
|
-
::HSBType = HSBType
|
11
|
+
# global alias - required for jrubyscripting addon <= OH3.2.0
|
12
|
+
::HSBType = HSBType if ::HSBType.is_a?(Java::JavaLang::Class)
|
13
13
|
|
14
14
|
# Adds methods to core OpenHAB HSBType to make it more natural in Ruby
|
15
15
|
class HSBType < PercentType
|
@@ -7,8 +7,8 @@ module OpenHAB
|
|
7
7
|
module Types
|
8
8
|
PercentType = org.openhab.core.library.types.PercentType
|
9
9
|
|
10
|
-
# global alias
|
11
|
-
::PercentType = PercentType
|
10
|
+
# global alias - required for jrubyscripting addon <= OH3.2.0
|
11
|
+
::PercentType = PercentType if ::PercentType.is_a?(Java::JavaLang::Class)
|
12
12
|
|
13
13
|
# Adds methods to core OpenHAB PercentType to make it more natural in Ruby
|
14
14
|
class PercentType < DecimalType
|
@@ -5,9 +5,9 @@ module OpenHAB
|
|
5
5
|
module Types
|
6
6
|
PointType = org.openhab.core.library.types.PointType
|
7
7
|
|
8
|
-
# global scope
|
8
|
+
# global scope - required for jrubyscripting addon <= OH3.2.0
|
9
9
|
# @!visibility private
|
10
|
-
::PointType = PointType
|
10
|
+
::PointType = PointType if ::PointType.is_a?(Java::JavaLang::Class)
|
11
11
|
|
12
12
|
# Adds methods to core OpenHAB PointType to make it more natural in Ruby
|
13
13
|
class PointType
|
@@ -7,8 +7,8 @@ module OpenHAB
|
|
7
7
|
module Types
|
8
8
|
QuantityType = org.openhab.core.library.types.QuantityType
|
9
9
|
|
10
|
-
# global alias
|
11
|
-
::QuantityType = QuantityType
|
10
|
+
# global alias - required for jrubyscripting addon <= OH3.2.0
|
11
|
+
::QuantityType = QuantityType if ::QuantityType.is_a?(Java::JavaLang::Class)
|
12
12
|
|
13
13
|
# @deprecated
|
14
14
|
# Backwards-compatible alias
|
@@ -20,8 +20,8 @@ module OpenHAB
|
|
20
20
|
include NumericType
|
21
21
|
|
22
22
|
# private alias
|
23
|
-
|
24
|
-
private_constant :
|
23
|
+
ONE_UNIT = org.openhab.core.library.unit.Units::ONE
|
24
|
+
private_constant :ONE_UNIT
|
25
25
|
|
26
26
|
#
|
27
27
|
# Convert this quantity into a another unit
|
@@ -46,8 +46,8 @@ module OpenHAB
|
|
46
46
|
def <=>(other) # rubocop:disable Metrics
|
47
47
|
logger.trace("(#{self.class}) #{self} <=> #{other} (#{other.class})")
|
48
48
|
if other.is_a?(self.class)
|
49
|
-
return unitize(other.unit).compare_to(other) if unit ==
|
50
|
-
return compare_to(other.unitize(unit)) if other.unit ==
|
49
|
+
return unitize(other.unit).compare_to(other) if unit == ONE_UNIT
|
50
|
+
return compare_to(other.unitize(unit)) if other.unit == ONE_UNIT
|
51
51
|
|
52
52
|
compare_to(other)
|
53
53
|
elsif other.is_a?(Items::NumericItem) ||
|
@@ -88,7 +88,7 @@ module OpenHAB
|
|
88
88
|
elsif other.is_a?(Type)
|
89
89
|
[other, as(other.class)]
|
90
90
|
elsif other.respond_to?(:to_d)
|
91
|
-
[QuantityType.new(other.to_d.to_java,
|
91
|
+
[QuantityType.new(other.to_d.to_java, ONE_UNIT), self]
|
92
92
|
elsif other.is_a?(String)
|
93
93
|
[QuantityType.new(other), self]
|
94
94
|
end
|
@@ -215,7 +215,7 @@ module OpenHAB
|
|
215
215
|
logger.trace("Converting #{self} to #{other_unit}")
|
216
216
|
|
217
217
|
case unit
|
218
|
-
when
|
218
|
+
when ONE_UNIT
|
219
219
|
QuantityType.new(to_big_decimal, other_unit)
|
220
220
|
when other_unit
|
221
221
|
self
|
@@ -224,10 +224,10 @@ module OpenHAB
|
|
224
224
|
end
|
225
225
|
end
|
226
226
|
|
227
|
-
# if unit is +
|
227
|
+
# if unit is +ONE_UNIT+, return a plain Java BigDecimal
|
228
228
|
# @!visibility private
|
229
229
|
def deunitize
|
230
|
-
return to_big_decimal if unit ==
|
230
|
+
return to_big_decimal if unit == ONE_UNIT
|
231
231
|
|
232
232
|
self
|
233
233
|
end
|
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.30.
|
4
|
+
version: 4.30.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-01-
|
11
|
+
date: 2022-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|