Sha256: 01cbb483184b6f1eb35b6f0ca6a7756e04d48d9ee0e59234f6dbc39c6a41e760

Contents?: true

Size: 658 Bytes

Versions: 5

Compression:

Stored size: 658 Bytes

Contents

# frozen_string_literal: true
%w[session_adapter cookie_adapter redis_adapter dual_adapter].each do |f|
  require "split/persistence/#{f}"
end

module Split
  module Persistence
    ADAPTERS = {
      :cookie => Split::Persistence::CookieAdapter,
      :session => Split::Persistence::SessionAdapter
    }.freeze

    def self.adapter
      if persistence_config.is_a?(Symbol)
        ADAPTERS.fetch(persistence_config) { raise Split::InvalidPersistenceAdapterError }
      else
        persistence_config
      end
    end

    def self.persistence_config
      Split.configuration.persistence
    end
    private_class_method :persistence_config
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
split-2.2.0 lib/split/persistence.rb
split-2.1.0 lib/split/persistence.rb
split-2.0.0 lib/split/persistence.rb
split-1.7.0 lib/split/persistence.rb
split-1.6.0 lib/split/persistence.rb