module Quby::Compiler::DSL::Questions::Subquestions
Public Class Methods
new(key, **options, &block)
click to toggle source
Calls superclass method
# File lib/quby/compiler/dsl/questions/base.rb, line 114 def initialize(key, **options, &block) super @default_question_options = options[:default_question_options] || {} @title_question = nil end
Public Instance Methods
build()
click to toggle source
Calls superclass method
# File lib/quby/compiler/dsl/questions/base.rb, line 120 def build if @title_question @question.options.last.questions << @title_question @title_question = nil end super end
question(key, **options, &block)
click to toggle source
# File lib/quby/compiler/dsl/questions/base.rb, line 144 def question(key, **options, &block) options = @default_question_options.merge(options) .merge(questionnaire: @questionnaire, parent: @question, parent_option_key: @question.options.last.key) check_question_keys_uniqueness key, options, @questionnaire question = QuestionBuilder.build(key, **options, &block) @questionnaire.register_question(question) @question.options.last.questions << question end
title_question(key, **options, &block)
click to toggle source
# File lib/quby/compiler/dsl/questions/base.rb, line 129 def title_question(key, **options, &block) options = @default_question_options.merge({depends_on: @question.key, questionnaire: @questionnaire, parent: @question, presentation: :next_to_title, allow_blank_titles: @question.allow_blank_titles}.merge(options)) check_question_keys_uniqueness key, options, @questionnaire question = QuestionBuilder.build(key, **options, &block) @questionnaire.register_question(question) @title_question = question end