class ScheduleJob::Cron::TableParser

Public Class Methods

new(user_crontab_string) click to toggle source
# File lib/schedule_job/cron_parser.rb, line 35
def initialize(user_crontab_string)
  @user_crontab = TableParser.parse(user_crontab_string) rescue nil
end
parse(user_crontab_string) click to toggle source
# File lib/schedule_job/cron_parser.rb, line 31
def self.parse(user_crontab_string)
  Grammar.parse(user_crontab_string, root: :user_crontab)
end
valid?(user_crontab_string) click to toggle source
# File lib/schedule_job/cron_parser.rb, line 25
def self.valid?(user_crontab_string)
  !!parse(user_crontab_string)
rescue Citrus::ParseError => e
  false
end

Public Instance Methods

environment_vars() click to toggle source
# File lib/schedule_job/cron_parser.rb, line 51
def environment_vars
  @user_crontab&.capture(:environment)&.captures(:directive)
end
get_line_index(match) click to toggle source
# File lib/schedule_job/cron_parser.rb, line 43
def get_line_index(match)
  @user_crontab.input.line_index(match.offset)
end
get_line_number(match) click to toggle source
# File lib/schedule_job/cron_parser.rb, line 47
def get_line_number(match)
  @user_crontab.input.line_number(match.offset)
end
job_specs() click to toggle source
# File lib/schedule_job/cron_parser.rb, line 55
def job_specs
  @user_crontab&.capture(:jobspecs)&.captures(:jobspec)
end
valid?() click to toggle source
# File lib/schedule_job/cron_parser.rb, line 39
def valid?
  !!@user_crontab
end