Class: Lifesaver::Indexing::Indexer

Inherits:
Object
  • Object
show all
Defined in:
lib/lifesaver/indexing/indexer.rb

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Indexer

Returns a new instance of Indexer.



4
5
6
7
8
# File 'lib/lifesaver/indexing/indexer.rb', line 4

def initialize(args)
  @class_name = args.fetch(:class_name)
  @model_id = args.fetch(:model_id)
  @operation = args.fetch(:operation).to_sym
end

Instance Method Details

#performObject



10
11
12
13
14
15
16
17
# File 'lib/lifesaver/indexing/indexer.rb', line 10

def perform
  case operation
  when :update
    store
  when :destroy
    remove
  end
end