class Quby::Compiler::DSL::TableBuilder
Public Class Methods
new(panel, default_question_options: {}, **options)
click to toggle source
# File lib/quby/compiler/dsl/table_builder.rb, line 12 def initialize(panel, default_question_options: {}, **options) @panel = panel @table = Entities::Table.new(options) @default_question_options = default_question_options @panel.items << @table end
Public Instance Methods
description(value)
click to toggle source
# File lib/quby/compiler/dsl/table_builder.rb, line 23 def description(value) @table.description = value end
question(key, **options, &block)
click to toggle source
# File lib/quby/compiler/dsl/table_builder.rb, line 31 def question(key, **options, &block) options = @default_question_options.merge(options) .merge(table: @table, questionnaire: @panel.questionnaire) check_question_keys_uniqueness key, options, @panel.questionnaire fail "You can't create a slider in a table at the moment" if options[:as] == :slider question = QuestionBuilder.build(key, **options, &block) @panel.questionnaire.register_question(question) @table.items << question @panel.items << question end
text(value, **options)
click to toggle source
# File lib/quby/compiler/dsl/table_builder.rb, line 27 def text(value, **options) @table.items << Entities::Text.new(value.to_s, options) end
title(value)
click to toggle source
# File lib/quby/compiler/dsl/table_builder.rb, line 19 def title(value) @table.title = value end