Class: DestroySoon::Job
- Inherits:
-
Object
- Object
- DestroySoon::Job
- Defined in:
- lib/destroy_soon/job.rb
Instance Attribute Summary collapse
-
#entity_id ⇒ Object
Returns the value of attribute entity_id.
-
#entity_klass ⇒ Object
Returns the value of attribute entity_klass.
Instance Method Summary collapse
- #entity ⇒ Object
-
#initialize(opts) ⇒ Job
constructor
A new instance of Job.
- #perform ⇒ Object
Constructor Details
#initialize(opts) ⇒ Job
Returns a new instance of Job.
4 5 6 7 |
# File 'lib/destroy_soon/job.rb', line 4 def initialize(opts) @entity_id = opts[:entity].id @entity_klass = opts[:entity].class.to_s end |
Instance Attribute Details
#entity_id ⇒ Object
Returns the value of attribute entity_id.
3 4 5 |
# File 'lib/destroy_soon/job.rb', line 3 def entity_id @entity_id end |
#entity_klass ⇒ Object
Returns the value of attribute entity_klass.
3 4 5 |
# File 'lib/destroy_soon/job.rb', line 3 def entity_klass @entity_klass end |
Instance Method Details
#entity ⇒ Object
13 14 15 |
# File 'lib/destroy_soon/job.rb', line 13 def entity entity_klass.constantize.find_by_id(entity_id) end |
#perform ⇒ Object
9 10 11 |
# File 'lib/destroy_soon/job.rb', line 9 def perform entity.try(:destroy) end |