Class: Crony::CronStruct
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- Crony::CronStruct
show all
- Defined in:
- lib/crony/formatters/cron_struct.rb
Instance Method Summary
collapse
Instance Method Details
#collection? ⇒ Boolean
9
|
# File 'lib/crony/formatters/cron_struct.rb', line 9
def collection?; !!collection; end
|
#every? ⇒ Boolean
5
|
# File 'lib/crony/formatters/cron_struct.rb', line 5
def every?; !!every; end
|
24
25
26
|
# File 'lib/crony/formatters/cron_struct.rb', line 24
def format(*args)
send sym, *args
end
|
#frequency? ⇒ Boolean
6
|
# File 'lib/crony/formatters/cron_struct.rb', line 6
def frequency?; !!frequency; end
|
#range? ⇒ Boolean
7
|
# File 'lib/crony/formatters/cron_struct.rb', line 7
def range?; !!start && !!stop; end
|
#single_element ⇒ Object
12
|
# File 'lib/crony/formatters/cron_struct.rb', line 12
def single_element; collection[0]; end
|
#single_element? ⇒ Boolean
10
|
# File 'lib/crony/formatters/cron_struct.rb', line 10
def single_element?; collection? && collection.size == 1; end
|
#sym ⇒ Object
14
15
16
17
18
19
20
21
22
|
# File 'lib/crony/formatters/cron_struct.rb', line 14
def sym
return "e" if every?
return "f" if frequency? && range?
return "u" if frequency? && unbounded_range?
return "v" if frequency?
return "r" if range?
return "s" if single_element?
return "c" if collection?
end
|
#unbounded_range? ⇒ Boolean
8
|
# File 'lib/crony/formatters/cron_struct.rb', line 8
def unbounded_range?; !!start; end
|