Sha256: 51f0ad1c01121499fca6117445bdcc86d5e6fcc7d90c4700ec24257b595048e6

Contents?: true

Size: 647 Bytes

Versions: 10

Compression:

Stored size: 647 Bytes

Contents

%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
    }

    def self.adapter
      if persistence_config.is_a?(Symbol)
        adapter_class = ADAPTERS[persistence_config]
        raise Split::InvalidPersistenceAdapterError unless adapter_class
      else
        adapter_class = persistence_config
      end
      adapter_class
    end

    private

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

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
split-1.2.0 lib/split/persistence.rb
split-1.1.0 lib/split/persistence.rb
split-1.0.0 lib/split/persistence.rb
split-0.8.0 lib/split/persistence.rb
split-0.7.3 lib/split/persistence.rb
split-0.7.2 lib/split/persistence.rb
split-0.7.1 lib/split/persistence.rb
split-0.7.0 lib/split/persistence.rb
split-0.6.6 lib/split/persistence.rb
split-0.6.5 lib/split/persistence.rb