Class: Lobster::JobList
- Inherits:
-
Object
- Object
- Lobster::JobList
- Defined in:
- lib/lobster/job_list.rb
Instance Attribute Summary collapse
-
#jobs ⇒ Object
Returns the value of attribute jobs.
Instance Method Summary collapse
-
#cmd(command) ⇒ Object
backward compatibility.
-
#environment ⇒ Object
config data.
-
#initialize(config) ⇒ JobList
constructor
A new instance of JobList.
- #job(name) ⇒ Object
- #reload ⇒ Object
Constructor Details
#initialize(config) ⇒ JobList
Returns a new instance of JobList.
5 6 7 8 9 |
# File 'lib/lobster/job_list.rb', line 5 def initialize(config) @config = config @current_options = nil @jobs = {} end |
Instance Attribute Details
#jobs ⇒ Object
Returns the value of attribute jobs.
3 4 5 |
# File 'lib/lobster/job_list.rb', line 3 def jobs @jobs end |
Instance Method Details
#cmd(command) ⇒ Object
backward compatibility
40 41 42 |
# File 'lib/lobster/job_list.rb', line 40 def cmd(command) @current_options[:command] = command end |
#environment ⇒ Object
config data
45 46 47 |
# File 'lib/lobster/job_list.rb', line 45 def environment @config[:environment] end |
#job(name) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/lobster/job_list.rb', line 25 def job(name) @current_options = {} yield @new_jobs[name] ||= @jobs[name] || Job.new(name) @new_jobs[name].reload(@current_options, @config[:lobster_dir]) @current_options = nil end |
#reload ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/lobster/job_list.rb', line 11 def reload @new_jobs = {} file = @config[:schedule_file] instance_eval(File.read(file),file) # purely for logging @jobs.each do |name, job| Lobster.logger.info "Job #{name} deleted." unless @new_jobs[name] end @jobs = @new_jobs end |