Class: CDQ::CDQStoreManager

Inherits:
Object
  • Object
show all
Defined in:
motion/cdq/store.rb

Constant Summary collapse

STORE_DID_INITIALIZE_NOTIFICATION =
'com.infinitered.cdq.store.did_initialize'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ CDQStoreManager

Returns a new instance of CDQStoreManager.


10
11
12
13
# File 'motion/cdq/store.rb', line 10

def initialize(opts = {})
  @config = opts[:config] || CDQConfig.default
  @model_manager = opts[:model_manager]
end

Instance Attribute Details

#currentObject


22
23
24
# File 'motion/cdq/store.rb', line 22

def current
  @current ||= create_store
end

Instance Method Details

#invalid?Boolean

Returns:

  • (Boolean)

30
31
32
# File 'motion/cdq/store.rb', line 30

def invalid?
  !@current && @model_manager.invalid?
end

#new(opts = {}) ⇒ Object


15
16
17
18
19
20
# File 'motion/cdq/store.rb', line 15

def new(opts = {})
  @config = opts[:config] || CDQConfig.default
  @model_manager = opts[:model_manager] || CDQ.cdq.models
  @icloud = opts[:icloud] || opts[:iCloud] || @config.icloud
  @icloud_container = @config.icloud_container
end

#reset!Object


26
27
28
# File 'motion/cdq/store.rb', line 26

def reset!
  NSFileManager.defaultManager.removeItemAtURL(@config.database_url, error: nil)
end