class Cron::Parser::DayOfWeekField
Public Class Methods
allowed_special_characters()
click to toggle source
# File lib/cron/parser/day_of_week_field.rb, line 8 def self.allowed_special_characters; %w{ * / , - } end
allowed_values()
click to toggle source
# File lib/cron/parser/day_of_week_field.rb, line 3 def self.allowed_values ("0".."7").to_a + ("00".."07").to_a + %w{ sun mon tue wed thu fri sat }.map(&:upcase) end
ascii_weekday(day)
click to toggle source
Converts a numerical day of week value or 3-letter day of week value to human-readable week-day value.
# File lib/cron/parser/day_of_week_field.rb, line 39 def self.ascii_weekday(day) case day.to_s.downcase when "0", "00", "7", "07", "sun"; "Sunday" when "1", "01", "mon"; "Monday" when "2", "02", "tue"; "Tuesday" when "3", "03", "wed"; "Wednsday" when "4", "04", "thu"; "Thursday" when "5", "05", "fri"; "Friday" when "6", "06", "sat"; "Saturday" end end
generate_meaning(list, unit)
click to toggle source
Creates partial meaning (sentence) for the day of week field’s pattern.
# File lib/cron/parser/day_of_week_field.rb, line 29 def self.generate_meaning(list, unit) meaning = "" meaning += self.field_preposition(unit) meaning += " " meaning += list.map{ |d| self.ascii_weekday(d) }.uniq.join(", ") meaning end
lower_bound()
click to toggle source
# File lib/cron/parser/day_of_week_field.rb, line 10 def self.lower_bound; "7" end
specifications()
click to toggle source
Adds some day of week field-specific extra regular expressions to super class’s ‘specifications` method.
Calls superclass method
# File lib/cron/parser/day_of_week_field.rb, line 14 def self.specifications extra_specs = [ { rule: /\A(?<day>(sun|mon|tue|wed|thu|fri|sat))\Z/i, yields: ->(day, options) do return [day] if options[:exclude_preposition] return self.generate_meaning([day], options[:unit]) end, for_fields: %w{ day_of_week } }, ] super + extra_specs end
upper_bound()
click to toggle source
# File lib/cron/parser/day_of_week_field.rb, line 9 def self.upper_bound; "0" end