Class: Rapidfire::QuestionForm
- Inherits:
-
BaseService
- Object
- BaseService
- Rapidfire::QuestionForm
- Defined in:
- app/services/rapidfire/question_form.rb
Constant Summary collapse
- AVAILABLE_QUESTIONS =
[ Rapidfire::Questions::Checkbox, Rapidfire::Questions::Date, Rapidfire::Questions::Long, Rapidfire::Questions::Numeric, Rapidfire::Questions::Radio, Rapidfire::Questions::Select, Rapidfire::Questions::Short, Rapidfire::Questions::Information, Rapidfire::Questions::File, Rapidfire::Questions::MultiFile, ]
- QUESTION_TYPES =
AVAILABLE_QUESTIONS.inject({}) do |result, question| question_name = question.to_s.split("::").last result[question_name] = question.to_s result end
Instance Attribute Summary collapse
-
#answer_greater_than_or_equal_to ⇒ Object
Returns the value of attribute answer_greater_than_or_equal_to.
-
#answer_less_than_or_equal_to ⇒ Object
Returns the value of attribute answer_less_than_or_equal_to.
-
#answer_maximum_length ⇒ Object
Returns the value of attribute answer_maximum_length.
-
#answer_minimum_length ⇒ Object
Returns the value of attribute answer_minimum_length.
-
#answer_options ⇒ Object
Returns the value of attribute answer_options.
-
#answer_presence ⇒ Object
Returns the value of attribute answer_presence.
-
#default_text ⇒ Object
Returns the value of attribute default_text.
-
#placeholder ⇒ Object
Returns the value of attribute placeholder.
-
#position ⇒ Object
Returns the value of attribute position.
-
#question ⇒ Object
Returns the value of attribute question.
-
#question_text ⇒ Object
Returns the value of attribute question_text.
-
#survey ⇒ Object
Returns the value of attribute survey.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ QuestionForm
constructor
A new instance of QuestionForm.
- #save ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ QuestionForm
Returns a new instance of QuestionForm.
30 31 32 33 34 |
# File 'app/services/rapidfire/question_form.rb', line 30 def initialize(params = {}) from_question_to_attributes(params[:question]) if params[:question] super(params) @question ||= survey.questions.new end |
Instance Attribute Details
#answer_greater_than_or_equal_to ⇒ Object
Returns the value of attribute answer_greater_than_or_equal_to.
23 24 25 |
# File 'app/services/rapidfire/question_form.rb', line 23 def answer_greater_than_or_equal_to @answer_greater_than_or_equal_to end |
#answer_less_than_or_equal_to ⇒ Object
Returns the value of attribute answer_less_than_or_equal_to.
23 24 25 |
# File 'app/services/rapidfire/question_form.rb', line 23 def answer_less_than_or_equal_to @answer_less_than_or_equal_to end |
#answer_maximum_length ⇒ Object
Returns the value of attribute answer_maximum_length.
23 24 25 |
# File 'app/services/rapidfire/question_form.rb', line 23 def answer_maximum_length @answer_maximum_length end |
#answer_minimum_length ⇒ Object
Returns the value of attribute answer_minimum_length.
23 24 25 |
# File 'app/services/rapidfire/question_form.rb', line 23 def answer_minimum_length @answer_minimum_length end |
#answer_options ⇒ Object
Returns the value of attribute answer_options.
23 24 25 |
# File 'app/services/rapidfire/question_form.rb', line 23 def @answer_options end |
#answer_presence ⇒ Object
Returns the value of attribute answer_presence.
23 24 25 |
# File 'app/services/rapidfire/question_form.rb', line 23 def answer_presence @answer_presence end |
#default_text ⇒ Object
Returns the value of attribute default_text.
23 24 25 |
# File 'app/services/rapidfire/question_form.rb', line 23 def default_text @default_text end |
#placeholder ⇒ Object
Returns the value of attribute placeholder.
23 24 25 |
# File 'app/services/rapidfire/question_form.rb', line 23 def placeholder @placeholder end |
#position ⇒ Object
Returns the value of attribute position.
23 24 25 |
# File 'app/services/rapidfire/question_form.rb', line 23 def position @position end |
#question ⇒ Object
Returns the value of attribute question.
23 24 25 |
# File 'app/services/rapidfire/question_form.rb', line 23 def question @question end |
#question_text ⇒ Object
Returns the value of attribute question_text.
23 24 25 |
# File 'app/services/rapidfire/question_form.rb', line 23 def question_text @question_text end |
#survey ⇒ Object
Returns the value of attribute survey.
23 24 25 |
# File 'app/services/rapidfire/question_form.rb', line 23 def survey @survey end |
#type ⇒ Object
Returns the value of attribute type.
23 24 25 |
# File 'app/services/rapidfire/question_form.rb', line 23 def type @type end |
Instance Method Details
#save ⇒ Object
36 37 38 |
# File 'app/services/rapidfire/question_form.rb', line 36 def save @question.new_record? ? create_question : update_question end |