openhab-scripting 4.6.2 → 4.7.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0e7aabfc4cdcd9a89787c861b639e087f903e9f499db1e24d1b67b0baea71eb
|
4
|
+
data.tar.gz: d590f67786a6499e17afc791fe18564223d13a0792d649494b197daf2c688536
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91b26707cfa19145ad2d38587e476057a9ae7f8ac3c77a7a3c237f119c257ccbec79419fd77cd9b61656da8c6c18ff35be4ad14a1ea1d674ee3f28e26cc412aa
|
7
|
+
data.tar.gz: d168357490983f4ce8a5d3152394cf5c982270ae110d829096a32d9637dfc2c99a453a82783b4e5ba9300f5832632bedb88a077654623a43b8a0228bfe07cf40
|
@@ -25,6 +25,7 @@ module OpenHAB
|
|
25
25
|
extend Forwardable
|
26
26
|
|
27
27
|
def_delegator :@metadata, :value
|
28
|
+
def_delegator :__getobj__, :to_h, :to_hash
|
28
29
|
|
29
30
|
def initialize(metadata: nil, key: nil, value: nil, config: nil)
|
30
31
|
@metadata = metadata || Metadata.new(key || MetadataKey.new('', ''), value&.to_s, config)
|
@@ -68,6 +69,7 @@ module OpenHAB
|
|
68
69
|
# @return [Java::Org::openhab::core::items::Metadata] the old metadata
|
69
70
|
#
|
70
71
|
def config=(config)
|
72
|
+
config = config.to_hash if config.respond_to?(:to_hash)
|
71
73
|
raise ArgumentError, 'Configuration must be a hash' unless config.is_a? Hash
|
72
74
|
|
73
75
|
metadata = Metadata.new(@metadata&.uID, @metadata&.value, config)
|
@@ -158,7 +160,7 @@ module OpenHAB
|
|
158
160
|
meta_value, configuration = update_from_value(value)
|
159
161
|
|
160
162
|
key = MetadataKey.new(namespace, @item_name)
|
161
|
-
metadata = Metadata.new(key, meta_value&.to_s, configuration)
|
163
|
+
metadata = Metadata.new(key, meta_value&.to_s, configuration.to_h)
|
162
164
|
# registry.get can be omitted, but registry.update will log a warning for nonexistent metadata
|
163
165
|
if NamespaceAccessor.registry.get(key)
|
164
166
|
NamespaceAccessor.registry.update(metadata)
|
@@ -39,7 +39,7 @@ module OpenHAB
|
|
39
39
|
else
|
40
40
|
# Place in array and flatten to support multiple to elements or single or nil
|
41
41
|
[to].flatten.each do |to_state|
|
42
|
-
create_changed_trigger(item,
|
42
|
+
[from].flatten.each { |from_state| create_changed_trigger(item, from_state, to_state) }
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
data/lib/openhab/log/logger.rb
CHANGED
@@ -137,31 +137,36 @@ module OpenHAB
|
|
137
137
|
# @return [Logger] for the current class
|
138
138
|
#
|
139
139
|
def logger
|
140
|
-
Log.logger(self.class
|
140
|
+
Log.logger(self.class)
|
141
141
|
end
|
142
142
|
|
143
143
|
class << self
|
144
144
|
#
|
145
145
|
# Injects a logger into the base class
|
146
146
|
#
|
147
|
-
# @param [
|
147
|
+
# @param [Class] class the logger is for
|
148
148
|
#
|
149
149
|
# @return [Logger] for the supplied name
|
150
150
|
#
|
151
|
-
def logger(
|
152
|
-
|
151
|
+
def logger(klass)
|
152
|
+
if klass.respond_to?(:java_class) &&
|
153
|
+
klass.java_class &&
|
154
|
+
!klass.java_class.name.start_with?('org.jruby.Ruby')
|
155
|
+
klass = klass.java_class
|
156
|
+
end
|
157
|
+
name = klass.name
|
153
158
|
@loggers[name] ||= Log.logger_for(name)
|
154
159
|
end
|
155
160
|
|
156
161
|
#
|
157
162
|
# Configure a logger for the supplied class name
|
158
163
|
#
|
159
|
-
# @param [String]
|
164
|
+
# @param [String] name to configure logger for
|
160
165
|
#
|
161
166
|
# @return [Logger] for the supplied classname
|
162
167
|
#
|
163
|
-
def logger_for(
|
164
|
-
configure_logger_for(
|
168
|
+
def logger_for(name)
|
169
|
+
configure_logger_for(name)
|
165
170
|
end
|
166
171
|
|
167
172
|
private
|
@@ -173,10 +178,10 @@ module OpenHAB
|
|
173
178
|
#
|
174
179
|
# @return [Logger] Logger for the supplied classname
|
175
180
|
#
|
176
|
-
def configure_logger_for(
|
181
|
+
def configure_logger_for(name)
|
177
182
|
log_prefix = Configuration.log_prefix
|
178
|
-
log_prefix += if
|
179
|
-
".#{
|
183
|
+
log_prefix += if name
|
184
|
+
".#{name}"
|
180
185
|
else
|
181
186
|
".#{log_caller}"
|
182
187
|
end
|
@@ -207,7 +212,7 @@ module OpenHAB
|
|
207
212
|
def self.included(base)
|
208
213
|
class << base
|
209
214
|
def logger
|
210
|
-
Log.logger(self
|
215
|
+
Log.logger(self)
|
211
216
|
end
|
212
217
|
end
|
213
218
|
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.
|
4
|
+
version: 4.7.0
|
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-10-
|
11
|
+
date: 2021-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|