Class: Quby::Questionnaires::Entities::Questions::CheckboxQuestion
- Inherits:
-
Quby::Questionnaires::Entities::Question
- Object
- Item
- Quby::Questionnaires::Entities::Question
- Quby::Questionnaires::Entities::Questions::CheckboxQuestion
- Defined in:
- lib/quby/questionnaires/entities/questions/checkbox_question.rb
Constant Summary
Constants inherited from Quby::Questionnaires::Entities::Question
Quby::Questionnaires::Entities::Question::MARKDOWN_ATTRIBUTES
Instance Attribute Summary collapse
-
#check_all_option ⇒ Object
checkbox option that checks all other options on check.
-
#maximum_checked_allowed ⇒ Object
checkbox option that allows to select a maximum amount of checkboxes.
-
#minimum_checked_required ⇒ Object
checkbox option that forces to select a minimum amount of checkboxes.
-
#uncheck_all_option ⇒ Object
checkbox option that unchecks all other options on check.
Attributes inherited from Quby::Questionnaires::Entities::Question
#allow_blank_titles, #allow_duplicate_option_values, #as, #autocomplete, #col_span, #cols, #context_free_title, #default_invisible, #default_position, #dependencies, #depends_on, #description, #deselectable, #disallow_bulk, #display_modes, #extra_data, #group_maximum_answered, #group_minimum_answered, #hidden, #input_data, #key, #labels, #lines, #options, #parent, #parent_option_key, #question_group, #questionnaire, #row_span, #sbg_key, #score_header, #sets_textvar, #show_values, #size, #table, #title, #type, #unit, #validations
Attributes inherited from Item
#presentation, #raw_content, #switch_cycle
Instance Method Summary collapse
- #answer_keys ⇒ Object
- #as_json(options = {}) ⇒ Object
- #claimed_keys ⇒ Object
-
#initialize(key, options = {}) ⇒ CheckboxQuestion
constructor
A new instance of CheckboxQuestion.
Methods inherited from Quby::Questionnaires::Entities::Question
#hidden?, #html_id, #input_keys, #key_in_use?, #maximum, #minimum, #set_depends_on, #show_values_in_mode?, #subquestion?, #subquestions, #view_selector
Constructor Details
#initialize(key, options = {}) ⇒ CheckboxQuestion
Returns a new instance of CheckboxQuestion.
20 21 22 23 24 25 26 27 |
# File 'lib/quby/questionnaires/entities/questions/checkbox_question.rb', line 20 def initialize(key, = {}) super @check_all_option = [:check_all_option] @uncheck_all_option = [:uncheck_all_option] @maximum_checked_allowed = [:maximum_checked_allowed] @minimum_checked_required = [:minimum_checked_required] end |
Instance Attribute Details
#check_all_option ⇒ Object
checkbox option that checks all other options on check
9 10 11 |
# File 'lib/quby/questionnaires/entities/questions/checkbox_question.rb', line 9 def check_all_option @check_all_option end |
#maximum_checked_allowed ⇒ Object
checkbox option that allows to select a maximum amount of checkboxes
15 16 17 |
# File 'lib/quby/questionnaires/entities/questions/checkbox_question.rb', line 15 def maximum_checked_allowed @maximum_checked_allowed end |
#minimum_checked_required ⇒ Object
checkbox option that forces to select a minimum amount of checkboxes
18 19 20 |
# File 'lib/quby/questionnaires/entities/questions/checkbox_question.rb', line 18 def minimum_checked_required @minimum_checked_required end |
#uncheck_all_option ⇒ Object
checkbox option that unchecks all other options on check
12 13 14 |
# File 'lib/quby/questionnaires/entities/questions/checkbox_question.rb', line 12 def uncheck_all_option @uncheck_all_option end |
Instance Method Details
#answer_keys ⇒ Object
33 34 35 36 |
# File 'lib/quby/questionnaires/entities/questions/checkbox_question.rb', line 33 def answer_keys # Some options don't have a key (inner_title), they are stripped. .map { |opt| opt.input_key }.compact end |
#as_json(options = {}) ⇒ Object
38 39 40 |
# File 'lib/quby/questionnaires/entities/questions/checkbox_question.rb', line 38 def as_json( = {}) super.merge(options: @options.as_json) end |
#claimed_keys ⇒ Object
29 30 31 |
# File 'lib/quby/questionnaires/entities/questions/checkbox_question.rb', line 29 def claimed_keys [key] end |