Sha256: bb49783ec6068bdd72271996d4fd286d514d68c1a94e4fdeaa7c94e31822894c

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

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

module EenyMeeny
  class Railtie < Rails::Railtie
    config.eeny_meeny = ActiveSupport::OrderedOptions.new
    # default config values. these can be changed in the rails environment configuration.
    config.eeny_meeny.experiments = []
    config.eeny_meeny.secure = true
    config.eeny_meeny.secret = '9fc8b966eca7d03d55df40c01c10b8e02bf1f9d12d27b8968d53eb53e8c239902d00bf6afae5e726ce1111159eeb2f8f0e77233405db1d82dd71397f651a0a4f'
    config.eeny_meeny.cookies = ActiveSupport::OrderedOptions.new
    config.eeny_meeny.cookies.path = '/'
    config.eeny_meeny.cookies.same_site = :strict

    initializer 'eeny_meeny.initialize' do |app|
      ActionController::Base.send :include, EenyMeeny::ExperimentHelper
      ActionView::Base.send :include, EenyMeeny::ExperimentHelper

      app.middleware.insert_before 'ActionDispatch::Cookies', EenyMeeny::Middleware,
                                   config.eeny_meeny.experiments,
                                   config.eeny_meeny.secure,
                                   config.eeny_meeny.secret,
                                   config.eeny_meeny.cookies.path,
                                   config.eeny_meeny.cookies.same_site
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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