Class: Dropdown

Inherits:
Question show all
Defined in:
lib/ruql/dropdown.rb

Defined Under Namespace

Classes: DropdownChoice, DropdownText

Instance Attribute Summary collapse

Attributes inherited from Question

#answers, #name, #points, #question_comment, #question_group, #question_tags, #question_text, #randomize, #uid

Instance Method Summary collapse

Methods inherited from Question

#answer, #as_json, #comment, #correct_answer, #correct_answers, #distractor, #explanation, #group, #raw?, #tags, #text

Constructor Details

#initialize(opts = {}) ⇒ Dropdown

Returns a new instance of Dropdown.



15
16
17
18
# File 'lib/ruql/dropdown.rb', line 15

def initialize(opts={})
  super
  self.choices = []
end

Instance Attribute Details

#choicesObject

Returns the value of attribute choices.



13
14
15
# File 'lib/ruql/dropdown.rb', line 13

def choices
  @choices
end

Instance Method Details

#choice(correct, list) ⇒ Object



6
7
8
# File 'lib/ruql/dropdown.rb', line 6

def choice(correct, list)
  @choices << DropdownChoice.new(correct, list)
end

#label(str) ⇒ Object



9
10
11
# File 'lib/ruql/dropdown.rb', line 9

def label(str)
  @choices << DropdownChoice.new(0, [str])
end