Class: Mumukit::Auth::Store

Inherits:
Object
  • Object
show all
Defined in:
lib/mumukit/auth/store.rb

Instance Method Summary collapse

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

#closeObject



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