Class: Crony::CronStruct

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/crony/formatters/cron_struct.rb

Instance Method Summary collapse

Instance Method Details

#collection?Boolean

Returns:

  • (Boolean)


9
# File 'lib/crony/formatters/cron_struct.rb', line 9

def collection?; !!collection; end

#every?Boolean

Returns:

  • (Boolean)


5
# File 'lib/crony/formatters/cron_struct.rb', line 5

def every?; !!every; end

#format(*args) ⇒ Object



24
25
26
# File 'lib/crony/formatters/cron_struct.rb', line 24

def format(*args)
  send sym, *args
end

#frequency?Boolean

Returns:

  • (Boolean)


6
# File 'lib/crony/formatters/cron_struct.rb', line 6

def frequency?; !!frequency; end

#range?Boolean

Returns:

  • (Boolean)


7
# File 'lib/crony/formatters/cron_struct.rb', line 7

def range?; !!start && !!stop; end

#single_elementObject



12
# File 'lib/crony/formatters/cron_struct.rb', line 12

def single_element; collection[0]; end

#single_element?Boolean

Returns:

  • (Boolean)


10
# File 'lib/crony/formatters/cron_struct.rb', line 10

def single_element?; collection? && collection.size == 1; end

#symObject



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

Returns:

  • (Boolean)


8
# File 'lib/crony/formatters/cron_struct.rb', line 8

def unbounded_range?; !!start; end