Class: FmRest::TokenStore::ShortMemory

Inherits:
Base
  • Object
show all
Defined in:
lib/fmrest/token_store/short_memory.rb

Overview

Similar to Memory token store, but using instance vars instead of class vars. Mainly useful for specs, where we want to scope token persistance to a spec's context only

Instance Attribute Summary

Attributes inherited from Base

#options

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ ShortMemory

Returns a new instance of ShortMemory.



11
12
13
14
# File 'lib/fmrest/token_store/short_memory.rb', line 11

def initialize(*args)
  super
  @tokens ||= {}
end

Instance Method Details

#delete(key) ⇒ Object



16
17
18
# File 'lib/fmrest/token_store/short_memory.rb', line 16

def delete(key)
  @tokens.delete(key)
end

#load(key) ⇒ Object



20
21
22
# File 'lib/fmrest/token_store/short_memory.rb', line 20

def load(key)
  @tokens[key]
end

#store(key, value) ⇒ Object



24
25
26
# File 'lib/fmrest/token_store/short_memory.rb', line 24

def store(key, value)
  @tokens[key] = value
end