diff --git a/lib/fhir_models/bootstrap/model.rb b/lib/fhir_models/bootstrap/model.rb index 2e6cc80b..4e2c50eb 100644 --- a/lib/fhir_models/bootstrap/model.rb +++ b/lib/fhir_models/bootstrap/model.rb @@ -39,8 +39,8 @@ def ==(other) def method_missing(method_name, *_args, &_block) if defined?(self.class::MULTIPLE_TYPES) && self.class::MULTIPLE_TYPES[method_name.to_s] self.class::MULTIPLE_TYPES[method_name.to_s].each do |type| - type[0] = type[0].upcase - value = send("#{method_name}#{type}".to_sym) + capitalized_type = "#{type[0].upcase}#{type[1..]}" + value = send("#{method_name}#{capitalized_type}".to_sym) return value unless value.nil? end return nil @@ -284,10 +284,10 @@ def primitive?(datatype, value) end deprecate :is_primitive?, :primitive? - def check_binding_uri(uri, value) + def check_binding_uri(uri_with_version, value) valid = false # Strip off the |4.0.0 or |4.0.1 or |2014-03-26 or similar from the ends of URLs - uri&.gsub!(/\|[A-Za-z0-9.-]*/, '') + uri = uri_with_version&.gsub(/\|[A-Za-z0-9.-]*/, '') valueset = versioned_fhir_module::Definitions.get_codes(uri) if ['http://hl7.org/fhir/ValueSet/mimetypes', 'http://www.rfc-editor.org/bcp/bcp13.txt'].include?(uri) diff --git a/lib/fhir_models/fhirpath/evaluate.rb b/lib/fhir_models/fhirpath/evaluate.rb index 332bbde8..1699b492 100644 --- a/lib/fhir_models/fhirpath/evaluate.rb +++ b/lib/fhir_models/fhirpath/evaluate.rb @@ -13,14 +13,14 @@ def self.evaluate(expression, hash, parent = nil) # Get a value from a hash, with some special handling of # self references - def self.get(key, hash) - return @@context if ['$context', '$resource'].include?(key) - return @@parent if key == '$parent' - return 'http://unitsofmeasure.org' if key == '%ucum' - return 'http://snomed.info/sct' if key == '%sct' - return 'http://loinc.org' if key == '%loinc' - return key.gsub!(/\A\'|\'\Z/, '') if key.start_with?("'") && key.end_with?("'") - key.gsub!(/\A"|"\Z/, '') # remove quotes around path if they exist + def self.get(raw_key, hash) + return @@context if ['$context', '$resource'].include?(raw_key) + return @@parent if raw_key == '$parent' + return 'http://unitsofmeasure.org' if raw_key == '%ucum' + return 'http://snomed.info/sct' if raw_key == '%sct' + return 'http://loinc.org' if raw_key == '%loinc' + return raw_key.gsub(/\A\'|\'\Z/, '') if raw_key.start_with?("'") && raw_key.end_with?("'") + key = raw_key.gsub(/\A"|"\Z/, '') # remove quotes around path if they exist if hash.is_a?(Array) response = [] hash.each do |e|