diff --git a/lib/sidetiq.rb b/lib/sidetiq.rb index 8ac0477..17e7db9 100644 --- a/lib/sidetiq.rb +++ b/lib/sidetiq.rb @@ -20,6 +20,11 @@ require 'sidetiq/version' # The Sidetiq namespace. module Sidetiq + # Public: Returns an Array of workers including Sidetiq::Schedulable. + def self.workers + schedules.keys + end + # Public: Returns a Hash of Sidetiq::Schedule instances. def self.schedules Clock.synchronize do diff --git a/test/test_sidetiq.rb b/test/test_sidetiq.rb index 7af572a..009ae9e 100644 --- a/test/test_sidetiq.rb +++ b/test/test_sidetiq.rb @@ -6,5 +6,9 @@ class TestSidetiq < Sidetiq::TestCase assert_equal [ScheduledWorker], Sidetiq.schedules.keys assert_kind_of Sidetiq::Schedule, Sidetiq.schedules[ScheduledWorker] end + + def test_workers + assert_equal [ScheduledWorker], Sidetiq.workers + end end