Sha256: cbab9d39387d3edefdde9845eb074dbeb5693bf4466d55f651f96ab5e0675100

Contents?: true

Size: 1006 Bytes

Versions: 3

Compression:

Stored size: 1006 Bytes

Contents

require 'chartnado/version'
require 'chartnado/series'
require 'chartnado/group_by'
require 'chartnado/evaluator'
require 'chartnado/helpers/chart_helper'
require 'chartnado/helpers/series_helper'
require 'chartnado/hash'
require 'chartkick/remote'
require 'chartnado/engine' if defined?(Rails)

module Chartnado
  extend ActiveSupport::Concern
  attr_accessor :chartnado_options

  included do
    include Chartkick::Remote

    helper Chartnado::Helpers::Chart
  end

  module ClassMethods
    def chartnado_wrapper(wrapper_symbol = nil, **options, &block)
      unless block
        helper_method wrapper_symbol
        block = -> (*args, **options) do
          render_block = args.pop
          send(wrapper_symbol, *args, **options, &render_block)
        end
      end

      action_filter_options = options.extract!(:only, :except)

      before_filter action_filter_options do
        self.chartnado_options ||= {}
        self.chartnado_options[:wrapper_proc] = block
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
chartnado-0.1.0 lib/chartnado.rb
chartnado-0.0.2 lib/chartnado.rb
chartnado-0.0.1 lib/chartnado.rb