From 5521cb28a4d215cfc3175cd7abb2ac81228be106 Mon Sep 17 00:00:00 2001 From: 360dgries Date: Thu, 17 Oct 2024 15:57:19 -0400 Subject: [PATCH] replace string interpolation with const_get --- lib/fhir_client/ext/reference.rb | 10 +++++----- lib/fhir_client/version_management.rb | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/fhir_client/ext/reference.rb b/lib/fhir_client/ext/reference.rb index a9e90163..9e7a95d2 100644 --- a/lib/fhir_client/ext/reference.rb +++ b/lib/fhir_client/ext/reference.rb @@ -82,7 +82,7 @@ class Reference include FHIR::ReferenceExtras def resource_class - "FHIR::#{resource_type}".constantize unless contained? + FHIR.const_get(resource_type).constantize unless contained? end end end @@ -93,7 +93,7 @@ class Reference include FHIR::ReferenceExtras def resource_class - "FHIR::DSTU2::#{resource_type}".constantize unless contained? + FHIR::DSTU2.const_get(resource_type).constantize unless contained? end end end @@ -105,7 +105,7 @@ class Reference include FHIR::ReferenceExtras def resource_class - "FHIR::STU3::#{resource_type}".constantize unless contained? + FHIR::STU3.const_get(resource_type).constantize unless contained? end end end @@ -117,7 +117,7 @@ class Reference < FHIR::R4B::Model include FHIR::ReferenceExtras def resource_class - "FHIR::R4B::#{resource_type}".constantize unless contained? + FHIR::R4B.const_get(resource_type).constantize unless contained? end end end @@ -129,7 +129,7 @@ class Reference < FHIR::R5::Model include FHIR::ReferenceExtras def resource_class - "FHIR::R5::#{resource_type}".constantize unless contained? + FHIR::R5.const_get(resource_type).constantize unless contained? end end end diff --git a/lib/fhir_client/version_management.rb b/lib/fhir_client/version_management.rb index 7996fc35..7a8c22ea 100644 --- a/lib/fhir_client/version_management.rb +++ b/lib/fhir_client/version_management.rb @@ -8,9 +8,9 @@ def versioned_resource_class(klass = nil) when :dstu2 FHIR::DSTU2 when :r4b - defined?(FHIR::R4B) ? FHIR::R4B : FHIR + FHIR::R4B when :r5 - defined?(FHIR::R5) ? FHIR::R5 : FHIR + FHIR::R5 else FHIR end