3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/ext/data_element.rb', line 3
def merge!(other)
return unless qdmCategory == other.qdmCategory
return if respond_to?(:qdmStatus) && !other.respond_to?(:qdmStatus)
return if !respond_to?(:qdmStatus) && other.respond_to?(:qdmStatus)
return if respond_to?(:qdmStatus) && other.respond_to?(:qdmStatus) && qdmStatus != other.qdmStatus
fields.each_key do |field|
next if field[0] == '_' || %w[dataElementCodes category qdmVersion qdmStatus].include?(field)
if send(field).nil?
send(field + '=', other.send(field))
end
end
self.dataElementCodes = dataElementCodes.concat(other.dataElementCodes).uniq
end
|