openhab-scripting 4.11.1 → 4.11.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/metadata.rb +7 -7
- 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: 19cbbdcb66b30a84771b0f5d326d9a4a93aebdace2d56d8bb6fb69c256d0826e
|
4
|
+
data.tar.gz: bda4faa411f2fd7364f52e881e4c493329228060542d9f57de8a52b8cf3e6f92
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8eb6381c66788636e3a6f5e3fd98aab72a6a88919de848d3332a59cb1e94f4091cfbea6c2d6b0eb4fe81dc94c7cd4014e8d3ef5846a51658429922a883979a9
|
7
|
+
data.tar.gz: 7fc88a1936533792a385475b397deea0c9b7a67d5ef450ec502e0e39a7faa25528bafe30cf4946b407e3f4865fa883f9bdb71912bac7b88f2d411655749cbdba
|
@@ -29,7 +29,7 @@ module OpenHAB
|
|
29
29
|
|
30
30
|
def initialize(metadata: nil, key: nil, value: nil, config: nil)
|
31
31
|
@metadata = metadata || Metadata.new(key || MetadataKey.new('', ''), value&.to_s, config)
|
32
|
-
super(to_ruby(@metadata&.configuration))
|
32
|
+
super(MetadataItem.to_ruby(@metadata&.configuration))
|
33
33
|
end
|
34
34
|
|
35
35
|
#
|
@@ -86,8 +86,6 @@ module OpenHAB
|
|
86
86
|
[@metadata&.value, @metadata&.configuration || {}]
|
87
87
|
end
|
88
88
|
|
89
|
-
private
|
90
|
-
|
91
89
|
#
|
92
90
|
# Recursively convert the supplied Hash object into a Ruby Hash and recreate the keys and values
|
93
91
|
#
|
@@ -95,7 +93,7 @@ module OpenHAB
|
|
95
93
|
#
|
96
94
|
# @return [Hash] The converted hash
|
97
95
|
#
|
98
|
-
def to_ruby_hash(hash)
|
96
|
+
def self.to_ruby_hash(hash)
|
99
97
|
return unless hash.respond_to? :each_with_object
|
100
98
|
|
101
99
|
hash.each_with_object({}) { |(key, value), ruby_hash| ruby_hash[to_ruby(key)] = to_ruby(value) }
|
@@ -108,14 +106,14 @@ module OpenHAB
|
|
108
106
|
#
|
109
107
|
# @return [Array] The converted array
|
110
108
|
#
|
111
|
-
def to_ruby_array(array)
|
109
|
+
def self.to_ruby_array(array)
|
112
110
|
return unless array.respond_to? :each_with_object
|
113
111
|
|
114
112
|
array.each_with_object([]) { |value, ruby_array| ruby_array << to_ruby(value) }
|
115
113
|
end
|
116
114
|
|
117
115
|
# Convert the given object to Ruby equivalent
|
118
|
-
def to_ruby(value)
|
116
|
+
def self.to_ruby(value)
|
119
117
|
case value
|
120
118
|
when Hash, Java::JavaUtil::Map then to_ruby_hash(value)
|
121
119
|
when Array, Java::JavaUtil::List then to_ruby_array(value)
|
@@ -188,7 +186,9 @@ module OpenHAB
|
|
188
186
|
return unless block_given?
|
189
187
|
|
190
188
|
NamespaceAccessor.registry.getAll.each do |meta|
|
191
|
-
|
189
|
+
if meta.uID.itemName == @item_name
|
190
|
+
yield meta.uID.namespace, MetadataItem.to_ruby(meta.value), MetadataItem.to_ruby(meta.configuration)
|
191
|
+
end
|
192
192
|
end
|
193
193
|
end
|
194
194
|
|
data/lib/openhab/version.rb
CHANGED