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.



6
7
8
9
10
11
12
13
14
# File 'lib/whenever/job.rb', line 6

def initialize(options = {})
  @options = options
  
  @at                      = options[:at]
  @output_redirection      = options.has_key?(:output) ? options[:output] : :not_set
  @options[:environment] ||= :production
  @options[:path]        ||= Whenever.path
  @raw_syntex         = options[:raw_syntex] || false
end

Instance Attribute Details

#atObject

Returns the value of attribute at.



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

def at
  @at
end

#output_redirectionObject

Returns the value of attribute output_redirection.



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

def output_redirection
  @output_redirection
end

#raw_syntexObject

Returns the value of attribute raw_syntex.



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

def raw_syntex
  @raw_syntex
end

Instance Method Details

#outputObject



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

def output
  @options[:template].gsub(/:\w+/) do |key|
    @options[key.sub(':', '').to_sym]
  end
end