lib/hqmf-parser/1.0/restriction.rb in hqmf-parser-1.0.6 vs lib/hqmf-parser/1.0/restriction.rb in hqmf-parser-1.1.0

- old
+ new

@@ -2,11 +2,11 @@ # Represents a restriction on the allowable values of a data item class Restriction include HQMF1::Utilities - attr_reader :range, :comparison, :restrictions, :subset, :preconditions + attr_reader :range, :comparison, :restrictions, :subset, :preconditions, :expression attr_accessor :from_parent def initialize(entry, parent, doc) @doc = doc @entry = entry @@ -26,11 +26,13 @@ local_subset = attr_val('./cda:subsetCode/@code') if local_subset @subset = local_subset end - #@subset = attr_val('./cda:subsetCode/@code') + if @entry.at_xpath('./*/cda:derivationExpr') + @expression = Expression.new(@entry) + end comparison_def = @entry.at_xpath('./*/cda:sourceOf[@typeCode="COMP"]') if comparison_def data_criteria_id = attr_val('./*/cda:id/@root') data_criteria_id = comparison_def.at_xpath('./*/cda:id/@root').value if (data_criteria_id.nil? and comparison_def.at_xpath('./*/cda:id/@root')) @@ -148,9 +150,10 @@ end end json[:comparison] = comparison.to_json if comparison json[:restrictions] = json_array(self.restrictions) json[:preconditions] = json_array(self.preconditions) + json[:expression] = self.expression.to_json if self.expression json end end end \ No newline at end of file