Class: MongoidSilo::UpdateSiloWorker

Inherits:
Object
  • Object
show all
Includes:
Sidekiq::Worker
Defined in:
app/workers/mongoid_silo/update_silo_worker.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#callbackObject (readonly)

Returns the value of attribute callback.



13
14
15
# File 'app/workers/mongoid_silo/update_silo_worker.rb', line 13

def callback
  @callback
end

#generatorObject (readonly)

Returns the value of attribute generator.



13
14
15
# File 'app/workers/mongoid_silo/update_silo_worker.rb', line 13

def generator
  @generator
end

#idObject (readonly)

Returns the value of attribute id.



13
14
15
# File 'app/workers/mongoid_silo/update_silo_worker.rb', line 13

def id
  @id
end

#klassObject (readonly)

Returns the value of attribute klass.



13
14
15
# File 'app/workers/mongoid_silo/update_silo_worker.rb', line 13

def klass
  @klass
end

#nameObject (readonly)

Returns the value of attribute name.



13
14
15
# File 'app/workers/mongoid_silo/update_silo_worker.rb', line 13

def name
  @name
end

Instance Method Details

#perform(id, klass, name, mode = :save, generator = nil, callback = nil) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'app/workers/mongoid_silo/update_silo_worker.rb', line 15

def perform(id, klass, name, mode = :save, generator = nil, callback = nil)
  @id        = id.kind_of?(String) ? id : id["$oid"]
  @klass     = klass.constantize
  @generator = generator ? generator.constantize : nil
  @callback  = callback
  @name      = name

  __send__(mode.to_sym)
end