Class: Mumukit::Auth::Store
- Inherits:
-
Object
- Object
- Mumukit::Auth::Store
- Defined in:
- lib/mumukit/auth/store.rb
Instance Method Summary collapse
- #close ⇒ Object
- #get(key) ⇒ Object
-
#initialize(db_name) ⇒ Store
constructor
A new instance of Store.
- #set!(key, value) ⇒ Object
Constructor Details
#initialize(db_name) ⇒ Store
Returns a new instance of Store.
4 5 6 |
# File 'lib/mumukit/auth/store.rb', line 4 def initialize(db_name) @db = Daybreak::DB.new "#{db_name}.db", default: '{}' end |
Instance Method Details
#close ⇒ Object
16 17 18 |
# File 'lib/mumukit/auth/store.rb', line 16 def close @db.close end |
#get(key) ⇒ Object
12 13 14 |
# File 'lib/mumukit/auth/store.rb', line 12 def get(key) Mumukit::Auth::Permissions.load @db[key] end |
#set!(key, value) ⇒ Object
8 9 10 |
# File 'lib/mumukit/auth/store.rb', line 8 def set!(key, value) @db.update! key.to_sym => value.to_json end |