Class: Sidekiq::Repeat::MiniIceCube::CronSyntax

Inherits:
Object
  • Object
show all
Includes:
IceCubeDslErrorHandling
Defined in:
lib/sidekiq/repeat/mini_ice_cube.rb

Constant Summary

Constants included from IceCubeDslErrorHandling

IceCubeDslErrorHandling::IceCubeSyntaxError

Class Method Summary collapse

Instance Method Summary collapse

Methods included from IceCubeDslErrorHandling

#method_missing, #unsupported

Constructor Details

#initialize(*args) ⇒ CronSyntax

Returns a new instance of CronSyntax.



34
35
36
# File 'lib/sidekiq/repeat/mini_ice_cube.rb', line 34

def initialize(*args)
  @slots = args
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Sidekiq::Repeat::MiniIceCube::IceCubeDslErrorHandling

Class Method Details

.define_items_method(name, slot) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/sidekiq/repeat/mini_ice_cube.rb', line 25

def define_items_method(name, slot)
  define_method(name) do |*args|
    unsupported("invalid arguments for #{name}") unless args.any? && args.all? { |i| i.is_a?(Integer) || i =~ /\d+/ }
    @slots[slot] = args.map(&:to_s).join(',')
    self
  end
end

Instance Method Details

#to_sObject



38
39
40
# File 'lib/sidekiq/repeat/mini_ice_cube.rb', line 38

def to_s
  @slots.map(&:to_s).join(' ')
end