Class: Afterparty::JobContainer
- Inherits:
-
Object
- Object
- Afterparty::JobContainer
- Defined in:
- lib/afterparty/job_container.rb
Instance Attribute Summary collapse
-
#execute_at ⇒ Object
Returns the value of attribute execute_at.
-
#job ⇒ Object
Returns the value of attribute job.
-
#job_id ⇒ Object
Returns the value of attribute job_id.
-
#queue_name ⇒ Object
Returns the value of attribute queue_name.
-
#raw ⇒ Object
Returns the value of attribute raw.
Instance Method Summary collapse
-
#initialize(_raw, timestamp) ⇒ JobContainer
constructor
intialized from redis’s WITHSCORES function.
- #job_class ⇒ Object
- #raw_string ⇒ Object
Constructor Details
#initialize(_raw, timestamp) ⇒ JobContainer
intialized from redis’s WITHSCORES function
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/afterparty/job_container.rb', line 9 def initialize _raw, @execute_at = Time.at() begin @job = Afterparty.load(_raw) @job_id = job.afterparty_job_id if @job.respond_to? :afterparty_job_id @queue_name = job.afterparty_queue if @job.respond_to? :afterparty_queue rescue Exception => e ap "Error during load: #{e.}" @job = nil end @raw = _raw self end |
Instance Attribute Details
#execute_at ⇒ Object
Returns the value of attribute execute_at.
6 7 8 |
# File 'lib/afterparty/job_container.rb', line 6 def execute_at @execute_at end |
#job ⇒ Object
Returns the value of attribute job.
6 7 8 |
# File 'lib/afterparty/job_container.rb', line 6 def job @job end |
#job_id ⇒ Object
Returns the value of attribute job_id.
6 7 8 |
# File 'lib/afterparty/job_container.rb', line 6 def job_id @job_id end |
#queue_name ⇒ Object
Returns the value of attribute queue_name.
6 7 8 |
# File 'lib/afterparty/job_container.rb', line 6 def queue_name @queue_name end |
#raw ⇒ Object
Returns the value of attribute raw.
6 7 8 |
# File 'lib/afterparty/job_container.rb', line 6 def raw @raw end |
Instance Method Details
#job_class ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/afterparty/job_container.rb', line 23 def job_class if @job @job.class else nil end end |
#raw_string ⇒ Object
31 32 33 34 |
# File 'lib/afterparty/job_container.rb', line 31 def raw_string ic = Iconv.new('UTF-8//IGNORE', 'UTF-8') ic.iconv(@raw.dup + ' ')[0..-2] end |