Class: Rack::OAuth2Utils::TestStore

Inherits:
Object
  • Object
show all
Defined in:
lib/rack-oauth2_utils/test_store.rb

Overview

Test persistent store. Stores to FS using PStore Not meant for production!

Instance Method Summary collapse

Constructor Details

#initialize(file_path = '.') ⇒ TestStore

Returns a new instance of TestStore.



9
10
11
# File 'lib/rack-oauth2_utils/test_store.rb', line 9

def initialize(file_path = '.')
  @store = PStore.new(file_path)
end

Instance Method Details

#[](key) ⇒ Object



19
20
21
22
23
# File 'lib/rack-oauth2_utils/test_store.rb', line 19

def [](key)
  @store.transaction do
    @store[key]
  end
end

#[]=(key, value) ⇒ Object



13
14
15
16
17
# File 'lib/rack-oauth2_utils/test_store.rb', line 13

def []=(key, value)
  @store.transaction do
    @store[key] = value
  end
end

#delete(key) ⇒ Object



25
26
27
28
29
# File 'lib/rack-oauth2_utils/test_store.rb', line 25

def delete(key)
  @store.transaction do
    @store.delete(key)
  end
end

#rootsObject



31
32
33
34
35
# File 'lib/rack-oauth2_utils/test_store.rb', line 31

def roots
  @store.transaction do
    @store.roots
  end
end