Class: Jumbotron::Scheduling::Backends::SolidQueue

Inherits:
Object
  • Object
show all
Defined in:
app/scheduling/jumbotron/scheduling/backends/solid_queue.rb

Constant Summary collapse

ENV_SECTIONS =
%w[development test production staging].freeze
DEFAULT_RELATIVE =
"config/recurring.yml"

Instance Method Summary collapse

Constructor Details

#initialize(path: nil) ⇒ SolidQueue

Returns a new instance of SolidQueue.



14
15
16
# File 'app/scheduling/jumbotron/scheduling/backends/solid_queue.rb', line 14

def initialize(path: nil)
  @explicit_path = path
end

Instance Method Details

#materialize(schedules, path: nil) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
# File 'app/scheduling/jumbotron/scheduling/backends/solid_queue.rb', line 18

def materialize(schedules, path: nil)
  destination = Pathname.new(path || @explicit_path || default_path)
  document = load_document(destination)
  section = current_section(document)
  section.delete_if { |key, _| Owned.key?(key) }
  schedules.sort_by(&:id).each do |definition|
    section[definition.id] = task_for(definition)
  end
  write_document(destination, document)
  destination
end

#schedule_string(cadence) ⇒ Object



30
31
32
# File 'app/scheduling/jumbotron/scheduling/backends/solid_queue.rb', line 30

def schedule_string(cadence)
  Clock.fugit(cadence)
end