openhab-scripting 4.6.1 → 4.6.2
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 +12 -1
- data/lib/openhab/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 287e243222ea07f7a3157b208722d47f489f14456713ad86401292f6b2fda942
|
4
|
+
data.tar.gz: 44968c29cf24415646ebb27ce64c3894966c4e9f9707edcd303eb89d4a4b1f04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12ce91f43449208a374b04ab92171a93c4ab3b68f2fee8ce7f948f7bf21f2be4a8d967b8f5758be957f5ca36cac831ebcb5f184204d650ed50d1fb345b1c2f7a
|
7
|
+
data.tar.gz: d7da5a64ab6aef028308a998ea83a77da1d77d12cbccb24c34875f6e51a9c6360e204efd75287de4d4f1fbc17b9bcd722057da227821f519452945fb17fd1666
|
@@ -15,10 +15,11 @@ module OpenHAB
|
|
15
15
|
include ComparableItem
|
16
16
|
|
17
17
|
# apply meta-programming methods to including class
|
18
|
+
# @!visibility private
|
18
19
|
def self.included(klass)
|
19
20
|
klass.prepend ItemEquality # make sure this is first
|
20
21
|
klass.extend Forwardable
|
21
|
-
klass.delegate %i[+ - * / % |
|
22
|
+
klass.delegate %i[+ - * / % | to_d to_f to_i to_int] => :state
|
22
23
|
# remove the JRuby default == so that we can inherit the Ruby method
|
23
24
|
klass.remove_method :==
|
24
25
|
end
|
@@ -62,6 +63,16 @@ module OpenHAB
|
|
62
63
|
|
63
64
|
super
|
64
65
|
end
|
66
|
+
|
67
|
+
%i[positive? negative? zero?].each do |predicate|
|
68
|
+
class_eval <<~RUBY, __FILE__, __LINE__ + 1
|
69
|
+
def #{predicate} # def positive?
|
70
|
+
return false unless state? # return false unless state?
|
71
|
+
#
|
72
|
+
state.#{predicate} # state.positive?
|
73
|
+
end # end
|
74
|
+
RUBY
|
75
|
+
end
|
65
76
|
end
|
66
77
|
end
|
67
78
|
end
|
data/lib/openhab/version.rb
CHANGED