Sha256: 1c6f2f1f784cb39c94601c21f1682a794030d664a5935bf7b53fee96895b364f

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.4 lib/split/persistence.rb
split-4.0.3 lib/split/persistence.rb
split-4.0.2 lib/split/persistence.rb