Class: Minicron::Hub::Schedule

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/minicron/hub/models/schedule.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.format(schedule) ⇒ Object

Format the schedule based on all it's components

Parameters:

Returns:

  • string


15
16
17
18
19
20
21
22
# File 'lib/minicron/hub/models/schedule.rb', line 15

def self.format(schedule)
  # If it's not a 'special' schedule then build up the full schedule string
  if schedule.special == '' || schedule.special.nil?
    "#{schedule.minute} #{schedule.hour} #{schedule.day_of_the_month} #{schedule.month} #{schedule.day_of_the_week}"
  else
    schedule.special
  end
end

Instance Method Details

#formattedObject

The formatted schedule


7
8
9
# File 'lib/minicron/hub/models/schedule.rb', line 7

def formatted
  Minicron::Hub::Schedule.format(self)
end