Class: FHIR::StructureMapGroupRuleDependent

Inherits:
BackboneElement show all
Includes:
Mongoid::Document
Defined in:
app/models/fhir/structure_map_group_rule_dependent.rb

Overview

fhir/structure_map_group_rule_dependent.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.transform_json(json_hash, target = StructureMapGroupRuleDependent.new) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
# File 'app/models/fhir/structure_map_group_rule_dependent.rb', line 28

def self.transform_json(json_hash, target = StructureMapGroupRuleDependent.new)

  result = self.superclass.transform_json(json_hash, target)
  result['name'] = PrimitiveId.transform_json(json_hash['name'], json_hash['_name']) unless json_hash['name'].nil?
  result['variable'] = json_hash['variable'].each_with_index.map do |var, i|
    extension_hash = json_hash['_variable'] && json_hash['_variable'][i]
    PrimitiveString.transform_json(var, extension_hash)
  end unless json_hash['variable'].nil?

  result
end

Instance Method Details

#as_json(*args) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/models/fhir/structure_map_group_rule_dependent.rb', line 8

def as_json(*args)
  result = super      
  unless self.name.nil? 
    result['name'] = self.name.value
    serialized = Extension.serializePrimitiveExtension(self.name)            
    result['_name'] = serialized unless serialized.nil?
  end
  unless self.variable.nil?  || !self.variable.any? 
    result['variable'] = self.variable.compact().map{ |x| x.value }
    serialized = Extension.serializePrimitiveExtensionArray(self.variable)                              
    result['_variable'] = serialized unless serialized.nil? || !serialized.any?
  end
  result.delete('id')
  unless self.fhirId.nil?
    result['id'] = self.fhirId
    result.delete('fhirId')
  end  
  result
end