Class: DatabaseFlusher::Mongoid::DeletionStrategy::Subscriber

Inherits:
Object
  • Object
show all
Defined in:
lib/database_flusher/mongoid/deletion_strategy.rb

Instance Method Summary collapse

Constructor Details

#initialize(strategy) ⇒ Subscriber

Returns a new instance of Subscriber.



8
9
10
# File 'lib/database_flusher/mongoid/deletion_strategy.rb', line 8

def initialize(strategy)
  @strategy = strategy
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args, &block) ⇒ Object (private)



23
24
# File 'lib/database_flusher/mongoid/deletion_strategy.rb', line 23

def method_missing(*args, &block)
end

Instance Method Details

#started(event) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/database_flusher/mongoid/deletion_strategy.rb', line 12

def started(event)
  if event.command_name == :insert || event.command_name == 'insert'.freeze
    collection = event.command['insert'.freeze]
    if collection
      @strategy.collections << collection
    end
  end
end