Sha256: 761cf1a09c348d57be92177201c93dc873123160229bc817396bb46814aa36d4

Contents?: true

Size: 590 Bytes

Versions: 6

Compression:

Stored size: 590 Bytes

Contents

module SpiffyStoresApp
  class InMemorySessionStore
    class EnvironmentError < StandardError; end

    def self.retrieve(id)
      repo[id]
    end

    def self.store(session)
      id = SecureRandom.uuid
      repo[id] = session
      id
    end

    def self.clear
      @@repo = nil
    end

    def self.repo
      if Rails.env.production?
        raise EnvironmentError.new("Cannot use InMemorySessionStore in a Production environment. \
          Please initialize SpiffyStoresApp with a model that can store and retrieve sessions")
      end
      @@repo ||= {}
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
spiffy_stores_app-8.2.11 lib/spiffy_stores_app/session/in_memory_session_store.rb
spiffy_stores_app-8.2.10 lib/spiffy_stores_app/session/in_memory_session_store.rb
spiffy_stores_app-8.2.9 lib/spiffy_stores_app/session/in_memory_session_store.rb
spiffy_stores_app-8.2.8 lib/spiffy_stores_app/session/in_memory_session_store.rb
spiffy_stores_app-8.2.7 lib/spiffy_stores_app/session/in_memory_session_store.rb
spiffy_stores_app-8.2.6 lib/spiffy_stores_app/session/in_memory_session_store.rb