Module: Quby::Questionnaires::DSL

Defined in:
lib/quby/questionnaires/dsl.rb,
lib/quby/questionnaires/dsl/base.rb,
lib/quby/questionnaires/dsl/helpers.rb,
lib/quby/questionnaires/dsl/panel_builder.rb,
lib/quby/questionnaires/dsl/score_builder.rb,
lib/quby/questionnaires/dsl/table_builder.rb,
lib/quby/questionnaires/dsl/questions/base.rb,
lib/quby/questionnaires/dsl/question_builder.rb,
lib/quby/questionnaires/dsl/calls_custom_methods.rb,
lib/quby/questionnaires/dsl/questionnaire_builder.rb,
lib/quby/questionnaires/dsl/charting/chart_builder.rb,
lib/quby/questionnaires/dsl/charting/bar_chart_builder.rb,
lib/quby/questionnaires/dsl/charting/line_chart_builder.rb,
lib/quby/questionnaires/dsl/charting/radar_chart_builder.rb,
lib/quby/questionnaires/dsl/standardized_panel_generators.rb,
lib/quby/questionnaires/dsl/charting/overview_chart_builder.rb,
lib/quby/questionnaires/dsl/questions/date_question_builder.rb,
lib/quby/questionnaires/dsl/questions/text_question_builder.rb,
lib/quby/questionnaires/dsl/questions/float_question_builder.rb,
lib/quby/questionnaires/dsl/questions/radio_question_builder.rb,
lib/quby/questionnaires/dsl/questions/select_question_builder.rb,
lib/quby/questionnaires/dsl/questions/string_question_builder.rb,
lib/quby/questionnaires/dsl/questions/integer_question_builder.rb,
lib/quby/questionnaires/dsl/questions/checkbox_question_builder.rb,
lib/quby/questionnaires/dsl/questions/deprecated_question_builder.rb

Defined Under Namespace

Modules: CallsCustomMethods, Helpers, QuestionBuilder, Questions, StandardizedPanelGenerators Classes: BarChartBuilder, Base, ChartBuilder, LineChartBuilder, OverviewChartBuilder, PanelBuilder, QuestionnaireBuilder, RadarChartBuilder, ScoreBuilder, TableBuilder

Class Method Summary collapse

Class Method Details

.build(key, sourcecode = nil, timestamp: nil, &block) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/quby/questionnaires/dsl.rb', line 18

def self.build(key, sourcecode = nil, timestamp: nil, &block)
  Entities::Questionnaire.new(key, last_update: timestamp).tap do |questionnaire|
    builder = QuestionnaireBuilder.new(questionnaire)
    builder.instance_eval(sourcecode, key) if sourcecode
    builder.instance_eval(&block) if block
    questionnaire.callback_after_dsl_enhance_on_questions
  end
end

.build_from_definition(definition) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/quby/questionnaires/dsl.rb', line 10

def self.build_from_definition(definition)
  Entities::Questionnaire.new(definition.key, last_update: definition.timestamp).tap do |questionnaire|
    builder = QuestionnaireBuilder.new(questionnaire)
    builder.instance_eval(definition.sourcecode, definition.path) if definition.sourcecode
    questionnaire.callback_after_dsl_enhance_on_questions
  end
end