Sha256: 4ce9a53295a842f7e7eff06ee8e013942a439b0ada48d7149a8fe8214e2f1368

Contents?: true

Size: 793 Bytes

Versions: 9

Compression:

Stored size: 793 Bytes

Contents

require 'quby/questionnaires/entities/charting/overview_chart'
require_relative 'chart_builder'

module Quby
  module Questionnaires
    module DSL
      class OverviewChartBuilder < ChartBuilder
        set_chart_class(Entities::Charting::OverviewChart)

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

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

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

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
quby-4.0.4 lib/quby/questionnaires/dsl/charting/overview_chart_builder.rb
quby-4.0.3 lib/quby/questionnaires/dsl/charting/overview_chart_builder.rb
quby-4.0.2 lib/quby/questionnaires/dsl/charting/overview_chart_builder.rb
quby-4.0.1 lib/quby/questionnaires/dsl/charting/overview_chart_builder.rb
quby-4.0.0 lib/quby/questionnaires/dsl/charting/overview_chart_builder.rb
quby-3.2.2 lib/quby/questionnaires/dsl/charting/overview_chart_builder.rb
quby-3.2.1 lib/quby/questionnaires/dsl/charting/overview_chart_builder.rb
quby-3.2.0 lib/quby/questionnaires/dsl/charting/overview_chart_builder.rb
quby-3.2.0.pre.pre1 lib/quby/questionnaires/dsl/charting/overview_chart_builder.rb