Sha256: 33d5cd0c8ede110739e4f5fbd0c2e0c9a5c0939fdc9e2b6bab6e6f49887db71e

Contents?: true

Size: 632 Bytes

Versions: 6

Compression:

Stored size: 632 Bytes

Contents

%w[session_adapter cookie_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

6 entries across 6 versions & 1 rubygems

Version Path
split-0.6.4 lib/split/persistence.rb
split-0.6.3 lib/split/persistence.rb
split-0.6.2 lib/split/persistence.rb
split-0.6.1 lib/split/persistence.rb
split-0.6.0 lib/split/persistence.rb
split-0.5.0 lib/split/persistence.rb