Class: Gel::DB::PStore
Instance Method Summary
collapse
#nested?, #owned?, #read?, #write?
Methods inherited from Gel::DB
new
Constructor Details
#initialize(root, name) ⇒ PStore
224
225
226
|
# File 'lib/gel/db.rb', line 224
def initialize(root, name)
@pstore = ::PStore.new("#{root}/#{name}.pstore", true)
end
|
Instance Method Details
#[](key) ⇒ Object
244
245
246
|
# File 'lib/gel/db.rb', line 244
def [](key)
@pstore[key.to_s]
end
|
#[]=(key, value) ⇒ Object
248
249
250
|
# File 'lib/gel/db.rb', line 248
def []=(key, value)
@pstore[key.to_s] = value
end
|
#each_key(&block) ⇒ Object
236
237
238
|
# File 'lib/gel/db.rb', line 236
def each_key(&block)
@pstore.roots.each(&block)
end
|
#key?(key) ⇒ Boolean
240
241
242
|
# File 'lib/gel/db.rb', line 240
def key?(key)
@pstore.key?(key.to_s)
end
|
#reading(&block) ⇒ Object
232
233
234
|
# File 'lib/gel/db.rb', line 232
def reading(&block)
@pstore.transaction(true, &block)
end
|
#writing(&block) ⇒ Object
228
229
230
|
# File 'lib/gel/db.rb', line 228
def writing(&block)
@pstore.transaction(false, &block)
end
|