Sha256: af1c899c9cb681fa231111a38f7e659062b51ee0bba907fc2a80707e7d750a86

Contents?: true

Size: 989 Bytes

Versions: 3

Compression:

Stored size: 989 Bytes

Contents

module Dashing
  class << self

    delegate :scheduler, :redis, to: :config

    attr_accessor :configuration

    def config
      self.configuration ||= Configuration.new
    end

    def configure
      yield config if block_given?
    end

    def first_dashboard
      files = Dir[config.dashboards_views_path.join('*')].collect { |f| File.basename(f, '.*') }
      files.sort.first
    end

    def send_event(id, data)
      event = data.merge(id: id, updatedAt: Time.now.utc.to_i).to_json
      redis.hset("#{Dashing.config.redis_namespace}.latest", id, event)
      redis.publish("#{Dashing.config.redis_namespace}.create", event)
    end

  end
end

begin
  require 'rails'
rescue LoadError
end

$stderr.puts <<-EOC if !defined?(Rails)
warning: no framework detected.

Your Gemfile might not be configured properly.
---- e.g. ----
Rails:
    gem 'dashing-rails'

EOC

require 'dashing/configuration'

if defined? Rails
  require 'dashing/engine'
  require 'dashing/railtie'
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dashing-rails-2.6.1 lib/dashing.rb
dashing-rails-2.6.0 lib/dashing.rb
dashing-rails-2.5.0 lib/dashing.rb