Sha256: 75280be87fa734693f06c6b31e9043e18a163ad843b695c29edcf70311ecc019

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

require 'eeny-meeny'
require 'eeny-meeny/experiment_helper'
require 'eeny-meeny/middleware'

module EenyMeeny
  class Railtie < Rails::Railtie
    config.eeny_meeny = ActiveSupport::OrderedOptions.new

    initializer 'eeny_meeny.configure' do |app|
      # Configrue EenyMeeny (defaults set in eeny_meeny.rb)
      EenyMeeny.configure do |config|
        config.cookies     = app.config.eeny_meeny[:cookies]     if app.config.eeny_meeny.has_key?(:cookies)
        config.experiments = app.config.eeny_meeny[:experiments] if app.config.eeny_meeny.has_key?(:experiments)
        config.secret      = app.config.eeny_meeny[:secret]      if app.config.eeny_meeny.has_key?(:secret)
        config.secure      = app.config.eeny_meeny[:secure]      if app.config.eeny_meeny.has_key?(:secure)
      end
      # Include Helpers in ActionController and ActionView
      ActionController::Base.send :include, EenyMeeny::ExperimentHelper
      ActionView::Base.send :include, EenyMeeny::ExperimentHelper
      # Insert Middleware
      app.middleware.insert_before 'ActionDispatch::Cookies', EenyMeeny::Middleware
    end

    rake_tasks do
      load 'tasks/cookie.rake'
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
eeny-meeny-2.0.0 lib/eeny-meeny/railtie.rb