Sha256: 883dd94f62bd095baf8bc155a661ea468dc265b61fa2786ec83b68ffeaa3a38e

Contents?: true

Size: 826 Bytes

Versions: 3

Compression:

Stored size: 826 Bytes

Contents

# frozen_string_literal: true

module Split
  module Persistence
    require 'split/persistence/cookie_adapter'
    require 'split/persistence/dual_adapter'
    require 'split/persistence/redis_adapter'
    require 'split/persistence/session_adapter'

    ADAPTERS = {
      cookie: Split::Persistence::CookieAdapter,
      session: Split::Persistence::SessionAdapter,
      redis: Split::Persistence::RedisAdapter,
      dual_adapter: Split::Persistence::DualAdapter
    }.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

3 entries across 3 versions & 1 rubygems

Version Path
split-4.0.1 lib/split/persistence.rb
split-4.0.0.pre2 lib/split/persistence.rb
split-4.0.0.pre lib/split/persistence.rb