Class: AskAwesomely::Field::MultipleChoice

Inherits:
Field
  • Object
show all
Defined in:
lib/ask_awesomely/field/multiple_choice.rb

Constant Summary

Constants inherited from Field

Field::VALID_FIELD_TYPES

Instance Attribute Summary

Attributes inherited from Field

#state

Instance Method Summary collapse

Methods inherited from Field

#ask, #description, #initialize, of_type, #ref, #required, #skip, #tags

Methods included from JsonBuilder

#build_json

Constructor Details

This class inherits a constructor from AskAwesomely::Field::Field

Instance Method Details

#align_verticallyObject



21
22
23
# File 'lib/ask_awesomely/field/multiple_choice.rb', line 21

def align_vertically
  @state.vertical_alignment = true
end

#allow_multiple_selectionsObject



9
10
11
# File 'lib/ask_awesomely/field/multiple_choice.rb', line 9

def allow_multiple_selections
  @state.allow_multiple_selections = true
end

#can_specify_otherObject



17
18
19
# File 'lib/ask_awesomely/field/multiple_choice.rb', line 17

def can_specify_other
  @state.add_other_choice = true
end

#choice(label) ⇒ Object



4
5
6
7
# File 'lib/ask_awesomely/field/multiple_choice.rb', line 4

def choice(label)
  @state.choices ||= []
  @state.choices << Choice.new(label: label)
end

#randomizeObject



13
14
15
# File 'lib/ask_awesomely/field/multiple_choice.rb', line 13

def randomize
  @state.randomize = true
end