Class: AskAwesomely::Field::OpinionScale
- Inherits:
-
Field
- Object
- Field
- AskAwesomely::Field::OpinionScale
show all
- Defined in:
- lib/ask_awesomely/field/opinion_scale.rb
Constant Summary
collapse
- POSSIBLE_STEPS =
5..11
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
#build_json
Instance Method Details
#left_side(label) ⇒ Object
18
19
20
21
|
# File 'lib/ask_awesomely/field/opinion_scale.rb', line 18
def left_side(label)
@state.labels ||= Hash.new(nil)
@state.labels[:left] = label
end
|
#middle(label) ⇒ Object
23
24
25
26
|
# File 'lib/ask_awesomely/field/opinion_scale.rb', line 23
def middle(label)
@state.labels ||= Hash.new(nil)
@state.labels[:center] = label
end
|
#right_side(label) ⇒ Object
28
29
30
31
|
# File 'lib/ask_awesomely/field/opinion_scale.rb', line 28
def right_side(label)
@state.labels ||= Hash.new(nil)
@state.labels[:right] = label
end
|
#starts_from_one ⇒ Object
14
15
16
|
# File 'lib/ask_awesomely/field/opinion_scale.rb', line 14
def starts_from_one
@state.start_at_one = true
end
|
#steps(steps) ⇒ Object
6
7
8
9
10
11
12
|
# File 'lib/ask_awesomely/field/opinion_scale.rb', line 6
def steps(steps)
unless POSSIBLE_STEPS.cover?(steps)
raise ArgumentError, "number of steps must be between #{POSSIBLE_STEPS.begin} and #{POSSIBLE_STEPS.end}"
end
@state.steps = steps
end
|