Sha256: 3cb36c1c6eb2d2f3b55b1b94a1f85cad55539e718f3896d511da67da71286191

Contents?: true

Size: 784 Bytes

Versions: 2

Compression:

Stored size: 784 Bytes

Contents

# stdlib
require "erb"
require "json"
require "securerandom"

# modules
require_relative "vega/method_helpers"
require_relative "vega/base_chart"
require_relative "vega/chart"
require_relative "vega/lite_chart"
require_relative "vega/spec"
require_relative "vega/helper"
require_relative "vega/version"

# integrations
require_relative "vega/engine" if defined?(Rails)

module Vega
  class << self
    # save chart method for now
    def start
      Chart.new
    end

    def lite
      LiteChart.new
    end

    def render(spec, nonce: nil)
      Spec.new(spec).to_html(nonce: nonce)
    end

    def display(spec)
      IRuby.display(Spec.new(spec))
    end
  end
end

if defined?(ActiveSupport.on_load)
  ActiveSupport.on_load(:action_view) do
    include Vega::Helper
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vega-0.4.0 lib/vega.rb
vega-0.3.2 lib/vega.rb