Sha256: e267f60b2dfaa000a637b9f1a00895bb99b8beb1b9e3b9a12045e2ce1f4f3574

Contents?: true

Size: 645 Bytes

Versions: 7

Compression:

Stored size: 645 Bytes

Contents

# frozen_string_literal: true
%w[session_adapter cookie_adapter redis_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

7 entries across 7 versions & 1 rubygems

Version Path
split-1.5.0 lib/split/persistence.rb
split-1.4.5 lib/split/persistence.rb
split-1.4.4 lib/split/persistence.rb
split-1.4.3 lib/split/persistence.rb
split-1.4.2 lib/split/persistence.rb
split-1.4.1 lib/split/persistence.rb
split-1.4.0 lib/split/persistence.rb