Class: Quby::Compiler::Entities::Questions::SelectQuestion

Inherits:
Quby::Compiler::Entities::Question show all
Defined in:
lib/quby/compiler/entities/questions/select_question.rb

Constant Summary

Constants inherited from Quby::Compiler::Entities::Question

Quby::Compiler::Entities::Question::MARKDOWN_ATTRIBUTES

Instance Attribute Summary

Attributes inherited from Quby::Compiler::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, #title_question, #type, #unit, #validations

Attributes inherited from Item

#presentation, #raw_content, #switch_cycle

Instance Method Summary collapse

Methods inherited from Quby::Compiler::Entities::Question

#answer_keys, #claimed_keys, #context_free_title_or_title, #expand_depends_on_input_keys, #hidden?, #html_id, #initialize, #input_keys, #key_in_use?, #maximum, #minimum, #set_depends_on, #show_values_in_mode?, #subquestion?, #subquestions, #title_question?, #view_selector

Methods inherited from Item

#initialize

Constructor Details

This class inherits a constructor from Quby::Compiler::Entities::Question

Instance Method Details

#as_json(options = {}) ⇒ Object



8
9
10
11
12
13
# File 'lib/quby/compiler/entities/questions/select_question.rb', line 8

def as_json(options = {})
  super.merge(
    children: @options.as_json.compact, # for now just options, but we'll add optgroups later.
    placeholder: @options.find { _1.placeholder }&.description # nil for no placeholder
  )
end