Sha256: 59d31e9efcec30908e47357037bbd4b379a849b706c36e5ca5d72b8e2f11fe28

Contents?: true

Size: 787 Bytes

Versions: 1

Compression:

Stored size: 787 Bytes

Contents

require 'rails'
require "pixelator/engine"


module Pixelator
  autoload :PixelatorController, 'pixelator/controllers/pixelator_controller'

  class << self
    attr_accessor :data
    attr_accessor :config_file
    attr_accessor :run_envs
  end

  def self.configure
    self.run_envs = ['production']
    yield(self) if block_given?
    self.data = HashWithIndifferentAccess.new
    self.data[:pixels] = YAML.load_file(config_file).with_indifferent_access
    self.data[:pixels].each do |k,v|
      if v.is_a?(Array)
        v.map! do |a|
          a['snippet'] = URI.escape(a['snippet'])
          a
        end
      end
    end
    self.data[:context] = HashWithIndifferentAccess.new
  end

  def self.pixels
    data[:pixels]
  end

  def self.context
    data[:context]
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pixelator-0.0.1 lib/pixelator.rb