Sha256: e9a0c857dc18c98f2fbc08f36f6ac4f556140a077b67ba940715c806fd09c435

Contents?: true

Size: 454 Bytes

Versions: 2

Compression:

Stored size: 454 Bytes

Contents

require 'action_view'

module Highcharts
  class Base < ActionView::Base

    def initialize(*args)
      args.extract_options!.each {|arg, value| self.send("#{arg}=", value)}
    end

    def render_options(args)
      attrs = []
      args.each do |t, a|
        a.split.each do |option|
          attrs << "#{option}: #{t == :objects ? send(option) : "'#{send(option)}'"}" if send(option).present?
        end
      end
      attrs
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
highcharts-js-rails-0.0.3 lib/highcharts/base.rb
highcharts-js-rails-0.0.2 lib/highcharts/base.rb