Class: CatEngine::Question::XMLMapper
- Inherits:
-
Struct
- Object
- Struct
- CatEngine::Question::XMLMapper
- Defined in:
- lib/cat_engine/question.rb
Instance Method Summary collapse
- #context ⇒ Object
- #id ⇒ Object
- #promis_id ⇒ Object
- #responses ⇒ Object
- #title ⇒ Object
- #to_h ⇒ Object
Instance Method Details
#context ⇒ Object
50 51 52 |
# File 'lib/cat_engine/question.rb', line 50 def context element_descriptions[0] end |
#id ⇒ Object
42 43 44 |
# File 'lib/cat_engine/question.rb', line 42 def id xml.xpath("//Item")[0]["FormItemOID"] end |
#promis_id ⇒ Object
46 47 48 |
# File 'lib/cat_engine/question.rb', line 46 def promis_id xml.xpath("//Item")[0]["ID"] end |
#responses ⇒ Object
58 59 60 61 62 |
# File 'lib/cat_engine/question.rb', line 58 def responses xml.xpath("//Map").map do |xml| Response.new(xml: xml) end end |
#title ⇒ Object
54 55 56 |
# File 'lib/cat_engine/question.rb', line 54 def title element_descriptions[1] end |
#to_h ⇒ Object
64 65 66 67 68 69 70 71 72 |
# File 'lib/cat_engine/question.rb', line 64 def to_h { id: id, promis_id: promis_id, context: context, title: title, responses: responses, } end |