Object
# File lib/whenever/job.rb, line 5 def initialize(options = {}) @options = options @at = options.delete(:at) @template = options.delete(:template) @job_template = options.delete(:job_template) || ":job" @options[:output] = Whenever::Output::Redirection.new(options[:output]).to_s if options.has_key?(:output) @options[:environment] ||= :production @options[:path] ||= Whenever.path end
# File lib/whenever/job.rb, line 41 def escape_double_quotes(str) str.gsub(/"/) { '\"' } end
# File lib/whenever/job.rb, line 37 def escape_single_quotes(str) str.gsub(/'/) { "'\\''" } end
# File lib/whenever/job.rb, line 22 def process_template(template, options) template.gsub(/:\w+/) do |key| before_and_after = [$`[-1..-1], $'[0..0]] option = options[key.sub(':', '').to_sym] if before_and_after.all? { |c| c == "'" } escape_single_quotes(option) elsif before_and_after.all? { |c| c == '"' } escape_double_quotes(option) else option end end end
Generated with the Darkfish Rdoc Generator 2.