Class: Quby::Questionnaires::DSL::OverviewChartBuilder

Inherits:
ChartBuilder
  • Object
show all
Defined in:
lib/quby/questionnaires/dsl/charting/overview_chart_builder.rb

Instance Method Summary collapse

Methods inherited from ChartBuilder

#build, chart_class, #chart_type, #plot, #range, set_chart_class, #tick_interval, #title, #y_categories, #y_range_categories

Constructor Details

#initialize(questionnaire, options = {}) ⇒ OverviewChartBuilder

Returns a new instance of OverviewChartBuilder.



10
11
12
13
# File 'lib/quby/questionnaires/dsl/charting/overview_chart_builder.rb', line 10

def initialize(questionnaire, options = {})
  @questionnaire = questionnaire
  @chart = self.class.chart_class.new
end

Instance Method Details

#subscore(key) ⇒ Object



15
16
17
# File 'lib/quby/questionnaires/dsl/charting/overview_chart_builder.rb', line 15

def subscore(key)
  @chart.subscore = key
end

#validate!Object



23
24
25
26
27
# File 'lib/quby/questionnaires/dsl/charting/overview_chart_builder.rb', line 23

def validate!
  fail ArgumentError, "subscore not specified" unless @chart.subscore.present?
  fail ArgumentError, "y_max not specified" unless @chart.y_max.present?
  true
end

#y_max(value) ⇒ Object



19
20
21
# File 'lib/quby/questionnaires/dsl/charting/overview_chart_builder.rb', line 19

def y_max(value)
  @chart.y_max = value
end