Class: ReactiveObservers::DatabaseAdapters::Factory

Inherits:
Object
  • Object
show all
Defined in:
lib/reactive_observers/database_adapters/factory.rb

Instance Method Summary collapse

Constructor Details

#initialize(configuration) ⇒ Factory

Returns a new instance of Factory.



8
9
10
# File 'lib/reactive_observers/database_adapters/factory.rb', line 8

def initialize(configuration)
  @configuration = configuration
end

Instance Method Details

#initialize_observer_listenersObject



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/reactive_observers/database_adapters/factory.rb', line 12

def initialize_observer_listeners
  collect_database_adapters.each do |database_adapter, klasses|
    case database_adapter
    when 'PostgreSQL'
      PostgreSQLAdapter.new(@configuration, klasses).start_listening
    when 'PostGIS'
      PostgreSQLAdapter.new(@configuration, klasses).start_listening
    else
      raise StandardError, "Reactive observers cannot be run with this database adapter: #{database_adapter}!"
    end
  end
end