Class: Whenever::Job

Inherits:
Object
  • Object
show all
Defined in:
lib/whenever/job.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Job

Returns a new instance of Job.



5
6
7
8
9
10
11
12
13
# 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

Instance Attribute Details

#atObject (readonly)

Returns the value of attribute at.



3
4
5
# File 'lib/whenever/job.rb', line 3

def at
  @at
end

Instance Method Details

#outputObject



15
16
17
18
# File 'lib/whenever/job.rb', line 15

def output
  job = process_template(@template, @options).strip
  process_template(@job_template, { :job => job }).strip
end