Class: RsyncCron::Cron

Inherits:
Object
  • Object
show all
Defined in:
lib/rsync_cron/cron.rb

Constant Summary collapse

ANY =
"*"

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mins: nil, hour: nil, day: nil, month: nil, week: nil) ⇒ Cron

Returns a new instance of Cron.



11
12
13
14
15
16
17
# File 'lib/rsync_cron/cron.rb', line 11

def initialize(mins: nil, hour: nil, day: nil, month: nil, week: nil)
  @mins = mins.to_a
  @hour = hour
  @day = day
  @month = month
  @week = week
end

Class Method Details

.factory(s) ⇒ Object



5
6
7
8
9
# File 'lib/rsync_cron/cron.rb', line 5

def self.factory(s)
  mins, hour, day, month, week = s.split(" ")
  mins = mins.split(",")
  new(mins: mins, hour: hour, day: day, month: month, week: week)
end

Instance Method Details

#to_sObject



19
20
21
# File 'lib/rsync_cron/cron.rb', line 19

def to_s
  "#{mins} #{hour} #{day} #{month} #{week}"
end