class CatEngine::Question::XMLMapper
Public Instance Methods
context()
click to toggle source
# File lib/cat_engine/question.rb, line 50 def context element_descriptions[0] end
id()
click to toggle source
# File lib/cat_engine/question.rb, line 42 def id xml.xpath("//Item")[0]["FormItemOID"] end
promis_id()
click to toggle source
# File lib/cat_engine/question.rb, line 46 def promis_id xml.xpath("//Item")[0]["ID"] end
responses()
click to toggle source
# File lib/cat_engine/question.rb, line 58 def responses xml.xpath("//Map").map do |xml| Response.new(xml: xml) end end
title()
click to toggle source
# File lib/cat_engine/question.rb, line 54 def title element_descriptions[1] end
to_h()
click to toggle source
# File lib/cat_engine/question.rb, line 64 def to_h { id: id, promis_id: promis_id, context: context, title: title, responses: responses, } end
Private Instance Methods
element_descriptions()
click to toggle source
# File lib/cat_engine/question.rb, line 76 def element_descriptions elements = xml.xpath("//Element")[0..-2] # drop last container element elements.map { |e| e["Description"] } # sometimes one, sometimes two end