Class: DatabaseFlusher::ActiveRecord::DeletionStrategy::Subscriber
- Inherits:
-
Object
- Object
- DatabaseFlusher::ActiveRecord::DeletionStrategy::Subscriber
- Defined in:
- lib/database_flusher/active_record/deletion_strategy.rb
Instance Method Summary collapse
- #call(_, _, _, _, payload) ⇒ Object
-
#initialize(strategy) ⇒ Subscriber
constructor
A new instance of Subscriber.
Constructor Details
#initialize(strategy) ⇒ Subscriber
Returns a new instance of Subscriber.
13 14 15 |
# File 'lib/database_flusher/active_record/deletion_strategy.rb', line 13 def initialize(strategy) @strategy = strategy end |
Instance Method Details
#call(_, _, _, _, payload) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/database_flusher/active_record/deletion_strategy.rb', line 17 def call(_, _, _, _, payload) sql = payload[:sql] match = sql.match(/\A\s*INSERT(?:\s+IGNORE)?(?:\s+INTO)?\s+(?:\.*[`"]?([^.\s`"]+)[`"]?)*/i) return unless match table = match[1] if table @strategy.tables << table end end |