lib/hqmf-parser/2.0/data_criteria.rb in health-data-standards-3.7.0 vs lib/hqmf-parser/2.0/data_criteria.rb in health-data-standards-4.0.0
- old
+ new
@@ -146,10 +146,13 @@
# clone method. This is needed because we need to extract a new source data criteria for variables
# typically "cloning" is done by re-parsing the xml entry, however with post processing that does
# not give us the correct SDC data when we are trying to recreate since we are looping back through
# the same data criteria before it has finished processing: See: DocUtilities.extract_source_data_criteria
def clone
- other = DataCriteria.new(@entry, @data_criteria_references, @occurrences_map)
+ # Using 'self.class.new' in order to allow this DataCriteria class as
+ # well as any future new extending DataCriteria classes to use this clone
+ # function.
+ other = self.class.new(@entry, @data_criteria_references, @occurrences_map)
other.instance_variable_set(:@id, @id)
other.instance_variable_set(:@original_id, @original_id)
other.instance_variable_set(:@property, @property)
other.instance_variable_set(:@type, @type)
other.instance_variable_set(:@status, @status)