openhab-scripting 4.11.1 → 4.11.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3264a393d9e32d434336802a9dcfd97f2d296b1f54cb3060650fd29ab7103b91
4
- data.tar.gz: 786046dd908aaa43250b374947b01dcbfb7455eb72105b504bb29e0cffe48545
3
+ metadata.gz: 19cbbdcb66b30a84771b0f5d326d9a4a93aebdace2d56d8bb6fb69c256d0826e
4
+ data.tar.gz: bda4faa411f2fd7364f52e881e4c493329228060542d9f57de8a52b8cf3e6f92
5
5
  SHA512:
6
- metadata.gz: d7c4684def0b1c2dd97d9bce9f191bcfb58c5e3bf07313916d240385dc0d891f987b30d92c38f27578e432e10c8318e2167dd92942f6b6d426e77e1d7c3f2be4
7
- data.tar.gz: '058b81f95f7d86e8cf35a30f8576679c49fab4181a1f7e1634f9d5997cb45a6f96c4cf35efc00627d954d4a71c2626bd4a82df527c0233685fd9c2e52061f6f6'
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
- yield meta.uID.namespace, meta.value, meta.configuration if meta.uID.itemName == @item_name
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
 
@@ -5,5 +5,5 @@
5
5
  #
6
6
  module OpenHAB
7
7
  # @return [String] Version of OpenHAB helper libraries
8
- VERSION = '4.11.1'
8
+ VERSION = '4.11.2'
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openhab-scripting
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.11.1
4
+ version: 4.11.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian O'Connell