Class: Smartdown::Api::MultipleChoice

Inherits:
Question
  • Object
show all
Defined in:
lib/smartdown/api/multiple_choice.rb

Instance Method Summary collapse

Methods inherited from Question

#body, #hint, #initialize, #title

Constructor Details

This class inherits a constructor from Smartdown::Api::Question

Instance Method Details

#nameObject



13
14
15
16
# File 'lib/smartdown/api/multiple_choice.rb', line 13

def name
  question = elements.find{|element| element.is_a? Smartdown::Model::Element::Question::MultipleChoice}
  question.name
end

#optionsObject



6
7
8
9
10
11
# File 'lib/smartdown/api/multiple_choice.rb', line 6

def options
  question = elements.find{|element| element.is_a? Smartdown::Model::Element::Question::MultipleChoice}
  question.choices.map do |choice|
    OpenStruct.new(:label => choice[1], :value => choice[0])
  end
end