Sha256: f6e19b6e598a11f056968433789226f95b6723d45bdb6d66671f439a191fb553

Contents?: true

Size: 606 Bytes

Versions: 1

Compression:

Stored size: 606 Bytes

Contents

module EenyMeeny::SharedMethods

  private

  def experiment_version(experiment_id)
    (Rails.application.config.eeny_meeny.experiments.
        try(:[], experiment_id.to_sym).try(:[], :version) || 1) rescue 1
  end

  def decrypt(cookie)
    begin
      if Rails.application.config.eeny_meeny.secure
        # Memoize encryptor to avoid creating new instances on every request.
        @@eeny_meeny_encryptor ||= EenyMeeny::Encryptor.new(Rails.application.config.eeny_meeny.secret)
        @@eeny_meeny_encryptor.decrypt(cookie)
      else
        cookie
      end
    rescue
      nil
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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