Class: Excursion::Datastores::Test
- Defined in:
- lib/excursion/datastores/test.rb
Instance Attribute Summary collapse
-
#pool ⇒ Object
Returns the value of attribute pool.
Instance Method Summary collapse
- #all ⇒ Object
- #application_class ⇒ Object
- #delete(key) ⇒ Object (also: #unset)
- #read(key) ⇒ Object (also: #get)
- #write(key, value) ⇒ Object (also: #set)
Methods inherited from Datastore
Instance Attribute Details
#pool ⇒ Object
Returns the value of attribute pool.
8 9 10 |
# File 'lib/excursion/datastores/test.rb', line 8 def pool @pool end |
Instance Method Details
#all ⇒ Object
32 33 34 |
# File 'lib/excursion/datastores/test.rb', line 32 def all HashWithIndifferentAccess.new(@pool) end |
#application_class ⇒ Object
10 11 12 |
# File 'lib/excursion/datastores/test.rb', line 10 def application_class Excursion::Pool::DummyApplication end |
#delete(key) ⇒ Object Also known as: unset
27 28 29 |
# File 'lib/excursion/datastores/test.rb', line 27 def delete(key) @pool.delete(key.to_sym) end |
#read(key) ⇒ Object Also known as: get
14 15 16 17 18 19 |
# File 'lib/excursion/datastores/test.rb', line 14 def read(key) return @pool[key.to_sym] if option_key?(key) return unless test_provider?(key) @pool[key.to_sym] ||= application_class.new(key, , ActionDispatch::Routing::RouteSet::NamedRouteCollection.new).to_cache end |
#write(key, value) ⇒ Object Also known as: set
22 23 24 |
# File 'lib/excursion/datastores/test.rb', line 22 def write(key, value) @pool[key.to_sym] = value end |