Class: CatEngine::Question::XMLMapper

Inherits:
Struct
  • Object
show all
Defined in:
lib/cat_engine/question.rb

Instance Method Summary collapse

Instance Method Details

#contextObject



50
51
52
# File 'lib/cat_engine/question.rb', line 50

def context
  element_descriptions[0]
end

#idObject



42
43
44
# File 'lib/cat_engine/question.rb', line 42

def id
  xml.xpath("//Item")[0]["FormItemOID"]
end

#promis_idObject



46
47
48
# File 'lib/cat_engine/question.rb', line 46

def promis_id
  xml.xpath("//Item")[0]["ID"]
end

#responsesObject



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

#titleObject



54
55
56
# File 'lib/cat_engine/question.rb', line 54

def title
  element_descriptions[1]
end

#to_hObject



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