Class: RHC::Auth::TokenStore
Instance Method Summary collapse
- #clear ⇒ Object
- #get(login, server) ⇒ Object
-
#initialize(dir) ⇒ TokenStore
constructor
A new instance of TokenStore.
- #put(login, server, token) ⇒ Object
Constructor Details
#initialize(dir) ⇒ TokenStore
Returns a new instance of TokenStore.
5 6 7 |
# File 'lib/rhc/auth/token_store.rb', line 5 def initialize(dir) @dir = dir end |
Instance Method Details
#clear ⇒ Object
17 18 19 20 21 |
# File 'lib/rhc/auth/token_store.rb', line 17 def clear Dir[File.join(@dir, "token_*")]. each{ |f| File.delete(f) unless File.directory?(f) }. present? end |
#get(login, server) ⇒ Object
9 10 11 |
# File 'lib/rhc/auth/token_store.rb', line 9 def get(login, server) self[key(login,server)] end |
#put(login, server, token) ⇒ Object
13 14 15 |
# File 'lib/rhc/auth/token_store.rb', line 13 def put(login, server, token) self[key(login,server)] = token end |