Class: TableSync::ReceivingHandler
- Inherits:
-
Rabbit::EventHandler
- Object
- Rabbit::EventHandler
- TableSync::ReceivingHandler
- Extended by:
- DSL
- Defined in:
- lib/table_sync/receiving_handler.rb
Instance Method Summary collapse
Methods included from DSL
Instance Method Details
#call ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/table_sync/receiving_handler.rb', line 10 def call raise TableSync::UndefinedConfig.new(model) if configs.blank? configs.each do |config| next unless config.allow_event?(event) data = processed_data(config) next if data.empty? case event when :update config.model.transaction do config.update(data) end when :destroy config.destroy(data.values.first) else raise "Unknown event: #{event}" end end end |