Class: ViewModel::DecSummaryWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/view_model/dec_summary_wrapper.rb

Defined Under Namespace

Classes: AssessmentNotSupported

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml, schema_type) ⇒ DecSummaryWrapper

Returns a new instance of DecSummaryWrapper.



10
11
12
13
14
15
16
17
18
# File 'lib/view_model/dec_summary_wrapper.rb', line 10

def initialize(xml, schema_type)
  # Hack to use symbols, we need to update all callers to use symbols instead
  schema_type = schema_type.to_sym

  # FIXME: For some reasons the XML is received as a string and not a Nokogiri Document (like other wrappers)
  xml_doc = Nokogiri.XML(xml, nil, nil, Nokogiri::XML::ParseOptions.new.huge.strict).remove_namespaces!
  @view_model = build_view_model(xml_doc, schema_type)
  @xml_summary = Presenter::Dec::XmlSummary.new(view_model)
end

Instance Attribute Details

#view_modelObject (readonly)

Returns the value of attribute view_model.



8
9
10
# File 'lib/view_model/dec_summary_wrapper.rb', line 8

def view_model
  @view_model
end

Instance Method Details

#to_xmlObject



24
25
26
# File 'lib/view_model/dec_summary_wrapper.rb', line 24

def to_xml
  @xml_summary.to_xml
end

#typeObject



20
21
22
# File 'lib/view_model/dec_summary_wrapper.rb', line 20

def type
  :DEC
end