Skip to content

Commit

Permalink
Avoid having to re-lookup Semantics::Property on every reference in 3…
Browse files Browse the repository at this point in the history
….4.x (#66)

Signed-off-by: Cody Cutrer <cody@cutrer.us>
  • Loading branch information
ccutrer authored Apr 23, 2023
1 parent c07a58d commit 619b899
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/openhab/core/items/semantics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ def self.const_missing(sym)
logger.trace("const missing, performing Semantics Lookup for: #{sym}")
# @deprecated OH3.4 - the Property tag had an ID of "MeasurementProperty" in OH3.4. This was corrected in OH4.
# make sure we compare against pre-release versions
target_sym = sym
if sym == :Property && Gem::Version.new(Core::VERSION) < Gem::Version.new("4.0.0.M1")
sym = :MeasurementProperty
end
Expand All @@ -499,7 +500,7 @@ def self.const_missing(sym)
&.then do |tag|
tag = tag.ruby_class
tag.singleton_class.include(TagClassMethods)
const_set(sym, tag)
const_set(target_sym, tag)
end
end

Expand Down

0 comments on commit 619b899

Please sign in to comment.