class Sidekiq::TrackableBatch::Tracking

Access TrackableBatch progress data (status).

Public Class Methods

new(bid) click to toggle source

@param (see TrackableBatch#initialize)

# File lib/sidekiq/trackable_batch/tracking.rb, line 11
def initialize(bid)
  @bid = bid
end

Public Instance Methods

to_h() click to toggle source

Get the current status of a {TrackableBatch} as a hash. (network request) @return [Hash] the {TrackableBatch}'s current status

# File lib/sidekiq/trackable_batch/tracking.rb, line 17
def to_h
  status = get_status(@bid).reduce({}) { |m, (k, v)| m.merge k.to_sym => v }
  {
    max: status.delete(:max).to_i,
    value: status[:value] ? status.delete(:value).to_i : nil,
    **status
  }
end