From d07c58461b8d9254de284885fae98b73fe7dda6d Mon Sep 17 00:00:00 2001 From: Cody Cutrer Date: Tue, 25 Jul 2023 11:23:03 -0600 Subject: [PATCH] Drop openHAB 4.0 snapshot compatibility SemanticTags.add was only in core for a short time, and not during any full release Signed-off-by: Cody Cutrer --- lib/openhab/core/items/semantics.rb | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/lib/openhab/core/items/semantics.rb b/lib/openhab/core/items/semantics.rb index cf9da16a2a..41c108b497 100644 --- a/lib/openhab/core/items/semantics.rb +++ b/lib/openhab/core/items/semantics.rb @@ -311,25 +311,16 @@ def add(label: nil, synonyms: "", description: "", **tags) synonyms = Array.wrap(synonyms).map { |s| s.to_s.strip } tags.map do |name, parent| - # @deprecated OH4.0.0.M4 missing registry - if Provider.registry - parent = lookup(parent) unless parent.is_a?(SemanticTag) - next if lookup(name) - next unless parent - - new_tag = org.openhab.core.semantics.SemanticTagImpl.new("#{parent.uid}_#{name}", - label, - description, - synonyms) - Provider.instance.add(new_tag) - lookup(name) - else - parent_is_tag = parent.respond_to?(:java_class) && parent.java_class < Tag.java_class - parent = parent_is_tag ? parent.java_class : parent.to_s - org.openhab.core.semantics.SemanticTags - .add(name.to_s, parent, label, synonyms.join(","), description) - &.then { lookup(name) } - end + parent = lookup(parent) unless parent.is_a?(SemanticTag) + next if lookup(name) + next unless parent + + new_tag = org.openhab.core.semantics.SemanticTagImpl.new("#{parent.uid}_#{name}", + label, + description, + synonyms) + Provider.instance.add(new_tag) + lookup(name) end.compact end end