Class: Sidekiq::Portal::JobManager Private

Inherits:
Object
  • Object
show all
Defined in:
lib/portal/job_manager.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0

Defined Under Namespace

Classes: Builder

Instance Method Summary collapse

Constructor Details

#initialize(job_registry) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

Since:

  • 0.1.0



13
14
15
# File 'lib/portal/job_manager.rb', line 13

def initialize(job_registry)
  @job_registry = job_registry
end

Instance Method Details

#each_job(&block) {|job| ... } ⇒ Enumerable

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • block (Block)

Yields:

  • (job)

Yield Parameters:

Returns:

  • (Enumerable)

Since:

  • 0.1.0



41
42
43
# File 'lib/portal/job_manager.rb', line 41

def each_job(&block)
  block_given? ? job_registry.each(&block) : job_registry.each
end

#each_time_point(&block) {|time| ... } ⇒ Enumerable

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • end_time (Time)
  • block (Block)

Yields:

  • time

Yield Parameters:

  • time (Time)

Returns:

  • (Enumerable)

Since:

  • 0.1.0



67
68
69
# File 'lib/portal/job_manager.rb', line 67

def each_time_point(&block)
  block_given? ? time_points.each(&block) : time_points.each
end

#resolve(job_klass) ⇒ Sidekiq::Portal::Job

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

Since:

  • 0.1.0



30
31
32
# File 'lib/portal/job_manager.rb', line 30

def resolve(job_klass)
  job_registry.resolve(job_klass)
end

#runnable?(job_klass) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Parameters:

  • job_klass (Class)

Since:

  • 0.1.0



22
23
24
# File 'lib/portal/job_manager.rb', line 22

def runnable?(job_klass)
  job_registry.include?(job_klass)
end

#time_pointsArray<Time>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Array<Time>)

Since:

  • 0.1.0



49
50
51
52
53
54
55
56
57
# File 'lib/portal/job_manager.rb', line 49

def time_points
  each_job
    .map(&:timeline)
    .map!(&:time_points)
    .tap(&:flatten!)
    .tap(&:sort!)
    .tap(&:uniq!)
    .tap { |points| points.select! { |point| point <= Time.current } }
end