Module: Untied::Consumer::Sync

Defined in:
lib/untied-consumer-sync.rb,
lib/untied-consumer-sync/config.rb,
lib/untied-consumer-sync/version.rb,
lib/untied-consumer-sync/backend/base.rb,
lib/untied-consumer-sync/zombificator.rb,
lib/untied-consumer-sync/observer_helper.rb,
lib/untied-consumer-sync/payload_proccessor.rb,
lib/untied-consumer-sync/untied_general_observer.rb

Defined Under Namespace

Modules: Backend, Zombificator Classes: Config, ObserverHelper, PayloadProccessor, UntiedGeneralObserver

Constant Summary collapse

VERSION =
"0.0.1"

Class Method Summary collapse

Class Method Details

.backendObject



50
51
52
# File 'lib/untied-consumer-sync.rb', line 50

def self.backend
  @@backend
end

.backend=(backend) ⇒ Object

Sets the backend that will be used



41
42
43
44
45
46
47
48
# File 'lib/untied-consumer-sync.rb', line 41

def self.backend=(backend)
  if backend.is_a? Symbol
    require "untied-consumer-sync-#{backend.to_s.gsub('_', '')}/backend/#{backend}"
    backend = "#{Sync}::Backend::#{backend.to_s.classify}::ModelHelper".
      constantize
  end
  @@backend = backend
end

.configObject



12
13
14
# File 'lib/untied-consumer-sync.rb', line 12

def self.config
  @config ||= Config.new
end

.configure {|config| ... } ⇒ Object

Configures untied-publisher. The options are defined at lib/untied-consumer-sync/config.rb

Yields:



18
19
20
21
22
23
24
25
26
# File 'lib/untied-consumer-sync.rb', line 18

def self.configure(&block)
  yield(config) if block_given?

  if config.model_data.blank?
    raise "Configure where your yml file is."
  end

  self.init_untied
end

.init_untiedObject

Initializes Untied Consumer



34
35
36
37
38
# File 'lib/untied-consumer-sync.rb', line 34

def self.init_untied
  Untied::Consumer.configure do |config_untied|
    config_untied.observers = [UntiedGeneralObserver]
  end
end

.model_dataObject

Loads model data structure



29
30
31
# File 'lib/untied-consumer-sync.rb', line 29

def self.model_data
  @model_data ||= YAML.load_file(Sync.config.model_data)
end