Sha256: f115c6a021a5163317165f15f1020029f03c1267147f1d13bd12ceca9046f9a9

Contents?: true

Size: 581 Bytes

Versions: 3

Compression:

Stored size: 581 Bytes

Contents

module SolidQueueDashboard
  module Decorators
    class RecurringTasksDecorator < SimpleDelegator
      def with_type(type)
        case type.to_sym
        when RecurringTask::JOB
          where.not(class_name: nil)
        when RecurringTask::COMMAND
          where.not(command: nil)
        else
          raise "Unknown type: #{type}"
        end
      end

      def each
        super do |task|
          yield RecurringTaskDecorator.new(task)
        end
      end

      def to_a
        super.map { |task| RecurringTaskDecorator.new(task) }
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
solid_queue_dashboard-0.2.0 lib/solid_queue_dashboard/decorators/recurring_tasks_decorator.rb
solid_queue_dashboard-0.1.1 lib/solid_queue_dashboard/decorators/recurring_tasks_decorator.rb
solid_queue_dashboard-0.1.0 lib/solid_queue_dashboard/decorators/recurring_tasks_decorator.rb