Class: When::Cron
- Inherits:
-
Object
- Object
- When::Cron
- Defined in:
- lib/when-cron/cron/cron.rb,
lib/when-cron/cron/validator.rb
Defined Under Namespace
Classes: Validator
Class Method Summary collapse
Instance Method Summary collapse
- #==(time) ⇒ Object
-
#initialize(cron) ⇒ Cron
constructor
A new instance of Cron.
Constructor Details
#initialize(cron) ⇒ Cron
11 12 13 |
# File 'lib/when-cron/cron/cron.rb', line 11 def initialize(cron) @cron = cron end |
Class Method Details
.valid(cron) ⇒ Object
7 8 9 |
# File 'lib/when-cron/cron/cron.rb', line 7 def self.valid(cron) new(cron) if valid?(cron) end |
.valid?(cron) ⇒ Boolean
3 4 5 |
# File 'lib/when-cron/cron/cron.rb', line 3 def self.valid?(cron) Validator.valid?(cron) end |
Instance Method Details
#==(time) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/when-cron/cron/cron.rb', line 15 def ==(time) @parsed ||= parse(@cron) @minute == time.min && @hour == time.hour && @day == time.day && @month == time.month && @wday == time.wday end |