Class: Excursion::Datastores::Test

Inherits:
Datastore
  • Object
show all
Defined in:
lib/excursion/datastores/test.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Datastore

#app

Instance Attribute Details

#poolObject

Returns the value of attribute pool.



8
9
10
# File 'lib/excursion/datastores/test.rb', line 8

def pool
  @pool
end

Instance Method Details

#delete(key) ⇒ Object Also known as: unset



21
22
23
# File 'lib/excursion/datastores/test.rb', line 21

def delete(key)
  @pool.delete(key.to_sym)
end

#read(key) ⇒ Object Also known as: get



10
11
12
13
# File 'lib/excursion/datastores/test.rb', line 10

def read(key)
  return unless Excursion.configuration.test_providers.nil? || Excursion.configuration.test_providers.map(&:to_sym).include?(key.to_sym)
  @pool[key.to_sym] ||= Excursion::Pool::DummyApplication.new(key, {host: 'test.local'}, ActionDispatch::Routing::RouteSet::NamedRouteCollection.new).to_cache
end

#write(key, value) ⇒ Object Also known as: set



16
17
18
# File 'lib/excursion/datastores/test.rb', line 16

def write(key, value)
  @pool[key.to_sym] = value
end