Module: Quby::Compiler::DSL::Questions::Subquestions
- Included in:
- CheckboxQuestionBuilder, RadioQuestionBuilder
- Defined in:
- lib/quby/compiler/dsl/questions/base.rb
Instance Method Summary collapse
- #initialize(key, **options, &block) ⇒ Object
- #question(key, **options, &block) ⇒ Object
- #title_question(key, **options, &block) ⇒ Object
Instance Method Details
#initialize(key, **options, &block) ⇒ Object
111 112 113 114 |
# File 'lib/quby/compiler/dsl/questions/base.rb', line 111 def initialize(key, **, &block) super @default_question_options = [:default_question_options] || {} end |
#question(key, **options, &block) ⇒ Object
131 132 133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/quby/compiler/dsl/questions/base.rb', line 131 def question(key, **, &block) = @default_question_options.merge() .merge(questionnaire: @questionnaire, parent: @question, parent_option_key: @question..last.key) check_question_keys_uniqueness key, , @questionnaire question = QuestionBuilder.build(key, **, &block) @questionnaire.register_question(question) @question..last.questions << question end |
#title_question(key, **options, &block) ⇒ Object
116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/quby/compiler/dsl/questions/base.rb', line 116 def title_question(key, **, &block) = @default_question_options.merge({depends_on: @question.key, questionnaire: @questionnaire, parent: @question, presentation: :next_to_title, allow_blank_titles: @question.allow_blank_titles}.merge()) check_question_keys_uniqueness key, , @questionnaire question = QuestionBuilder.build(key, **, &block) @questionnaire.register_question(question) @question.title_question = question end |