Module: Quby::Compiler::DSL

Defined in:
lib/quby/compiler/dsl.rb,
lib/quby/compiler/dsl/base.rb,
lib/quby/compiler/dsl/helpers.rb,
lib/quby/compiler/dsl/panel_builder.rb,
lib/quby/compiler/dsl/score_builder.rb,
lib/quby/compiler/dsl/table_builder.rb,
lib/quby/compiler/dsl/questions/base.rb,
lib/quby/compiler/dsl/question_builder.rb,
lib/quby/compiler/dsl/calls_custom_methods.rb,
lib/quby/compiler/dsl/score_schema_builder.rb,
lib/quby/compiler/dsl/questionnaire_builder.rb,
lib/quby/compiler/dsl/charting/chart_builder.rb,
lib/quby/compiler/dsl/charting/bar_chart_builder.rb,
lib/quby/compiler/dsl/charting/line_chart_builder.rb,
lib/quby/compiler/dsl/charting/radar_chart_builder.rb,
lib/quby/compiler/dsl/standardized_panel_generators.rb,
lib/quby/compiler/dsl/charting/overview_chart_builder.rb,
lib/quby/compiler/dsl/questions/date_question_builder.rb,
lib/quby/compiler/dsl/questions/text_question_builder.rb,
lib/quby/compiler/dsl/questions/float_question_builder.rb,
lib/quby/compiler/dsl/questions/radio_question_builder.rb,
lib/quby/compiler/dsl/questions/select_question_builder.rb,
lib/quby/compiler/dsl/questions/string_question_builder.rb,
lib/quby/compiler/dsl/questions/integer_question_builder.rb,
lib/quby/compiler/dsl/questions/checkbox_question_builder.rb,
lib/quby/compiler/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, ScoreSchemaBuilder, TableBuilder

Class Method Summary collapse

Class Method Details

.build(key, sourcecode = nil, path: nil, lookup_tables: {}, &block) ⇒ Object



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

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

.build_from_definition(definition) ⇒ Object



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

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