Class: FmRest::TokenStore::Moneta
- Defined in:
- lib/fmrest/token_store/moneta.rb
Constant Summary collapse
- DEFAULT_ADAPTER =
:Memory
- DEFAULT_PREFIX =
"fmrest-token:".freeze
Instance Attribute Summary collapse
-
#moneta ⇒ Object
readonly
Returns the value of attribute moneta.
Attributes inherited from Base
Instance Method Summary collapse
- #delete(key) ⇒ Object
-
#initialize(options = {}) ⇒ Moneta
constructor
A new instance of Moneta.
- #load(key) ⇒ Object
- #store(key, value) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Moneta
Returns a new instance of Moneta.
26 27 28 29 30 31 32 |
# File 'lib/fmrest/token_store/moneta.rb', line 26 def initialize( = {}) = .dup super() adapter = .delete(:adapter) || DEFAULT_ADAPTER [:prefix] ||= DEFAULT_PREFIX @moneta = ::Moneta.new(adapter, ) end |
Instance Attribute Details
#moneta ⇒ Object (readonly)
Returns the value of attribute moneta.
18 19 20 |
# File 'lib/fmrest/token_store/moneta.rb', line 18 def moneta @moneta end |
Instance Method Details
#delete(key) ⇒ Object
38 39 40 |
# File 'lib/fmrest/token_store/moneta.rb', line 38 def delete(key) moneta.delete(key) end |
#load(key) ⇒ Object
34 35 36 |
# File 'lib/fmrest/token_store/moneta.rb', line 34 def load(key) moneta[key] end |
#store(key, value) ⇒ Object
42 43 44 |
# File 'lib/fmrest/token_store/moneta.rb', line 42 def store(key, value) moneta[key] = value end |