Sha256: c3bdf071dd949831f550337a91c300224229b493d317b978aebf475c4bdfb17c

Contents?: true

Size: 314 Bytes

Versions: 2

Compression:

Stored size: 314 Bytes

Contents

require 'delegate'

module Suricate
  class ChartWidgetResponse < WidgetResponse
    def initialize
      @builder = ChartBuilder.new
      super
    end

    def chart
      yield @builder
    end

    def to_h
      super.tap do |hash|
        hash.merge!(chart: @builder.chart.to_h)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
suricate-0.0.4 lib/suricate/widgets/responses/chart_widget_response.rb
suricate-0.0.3 lib/suricate/widgets/responses/chart_widget_response.rb