Class: Rafflesia::JobQueueData

Inherits:
Types::BaseModel
  • Object
show all
Defined in:
lib/rafflesia/jobs/job_queue_data.rb

Constant Summary collapse

HASH_ATTRS =
{
  active: :active,
  pending: :pending,
  queue: :queue,
  retry: :retry,
  scheduled: :scheduled
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ JobQueueData

Returns a new instance of JobQueueData.



23
24
25
26
27
28
29
30
31
# File 'lib/rafflesia/jobs/job_queue_data.rb', line 23

def initialize(json)
  super()
  hash = self.class.normalize(json)
  @active = (hash[:active] || []).map { |item| item ? Rafflesia::JobQueueTask.new(item) : nil }
  @pending = (hash[:pending] || []).map { |item| item ? Rafflesia::JobQueueTask.new(item) : nil }
  @queue = hash[:queue] ? Rafflesia::JobQueueInfo.new(hash[:queue]) : nil
  @retry = (hash[:retry] || []).map { |item| item ? Rafflesia::JobQueueTask.new(item) : nil }
  @scheduled = (hash[:scheduled] || []).map { |item| item ? Rafflesia::JobQueueTask.new(item) : nil }
end

Instance Attribute Details

#activeObject

Returns the value of attribute active.



16
17
18
# File 'lib/rafflesia/jobs/job_queue_data.rb', line 16

def active
  @active
end

#pendingObject

Returns the value of attribute pending.



16
17
18
# File 'lib/rafflesia/jobs/job_queue_data.rb', line 16

def pending
  @pending
end

#queueObject

Returns the value of attribute queue.



16
17
18
# File 'lib/rafflesia/jobs/job_queue_data.rb', line 16

def queue
  @queue
end

#retryObject

Returns the value of attribute retry.



16
17
18
# File 'lib/rafflesia/jobs/job_queue_data.rb', line 16

def retry
  @retry
end

#scheduledObject

Returns the value of attribute scheduled.



16
17
18
# File 'lib/rafflesia/jobs/job_queue_data.rb', line 16

def scheduled
  @scheduled
end