Module: NanoStore
- Defined in:
- lib/nano_store/bag.rb,
lib/nano_store/model.rb,
lib/nano_store/finder.rb,
lib/nano_store/version.rb,
lib/nano_store/nano_store.rb,
lib/nano_store/association.rb
Defined Under Namespace
Modules: AssociationClassMethods, AssociationInstanceMethods, BagInstanceMethods, FinderMethods, ModelClassMethods, ModelInstanceMethods
Classes: Model, NanoStoreError
Constant Summary
collapse
- Bag =
::NSFNanoBag
- VERSION =
"0.6.3"
Class Method Summary
collapse
Class Method Details
.debug=(debug) ⇒ Object
set debug mode if YES, debug mode is on; otherwise debug mode is disabled.
32
33
34
|
# File 'lib/nano_store/nano_store.rb', line 32
def self.debug=(debug)
NSFSetIsDebugOn(debug)
end
|
.shared_store ⇒ Object
22
23
24
|
# File 'lib/nano_store/nano_store.rb', line 22
def self.shared_store
@shared_store
end
|
.shared_store=(store) ⇒ Object
26
27
28
|
# File 'lib/nano_store/nano_store.rb', line 26
def self.shared_store=(store)
@shared_store = store
end
|
.store(type = :memory, path = nil) ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/nano_store/nano_store.rb', line 4
def self.store(type=:memory, path=nil)
error_ptr = Pointer.new(:id)
case type
when :memory
store = NSFNanoStore.createAndOpenStoreWithType(NSFMemoryStoreType, path:nil, error: error_ptr)
when :temporary, :temp
store = NSFNanoStore.createAndOpenStoreWithType(NSFTemporaryStoreType, path:nil, error: error_ptr)
when :persistent, :file
store = NSFNanoStore.createAndOpenStoreWithType(NSFPersistentStoreType, path:path, error: error_ptr)
else
raise NanoStoreError.new("unexpected store type (#{type}), must be one of: :memory, :temporary or :persistent")
end
raise NanoStoreError, error_ptr[0].description if error_ptr[0]
store
end
|