Class: OTB::Job
- Inherits:
-
Object
- Object
- OTB::Job
- Defined in:
- lib/OTB/job.rb
Instance Attribute Summary collapse
-
#job ⇒ Object
Returns the value of attribute job.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(job) ⇒ Job
constructor
A new instance of Job.
Constructor Details
#initialize(job) ⇒ Job
Returns a new instance of Job.
6 7 8 9 10 |
# File 'lib/OTB/job.rb', line 6 def initialize(job) # Further version of the code might want to change the initialization and create several Job objects. # These could then be saved in the DB as such or passed to the queuer. @job = job end |
Instance Attribute Details
#job ⇒ Object
Returns the value of attribute job.
4 5 6 |
# File 'lib/OTB/job.rb', line 4 def job @job end |
Class Method Details
.parse(jobs) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/OTB/job.rb', line 12 def self.parse(jobs) jobs_array = jobs.split('\n') result_hash = {} if jobs == '' result_hash[''] ='' result_hash else jobs_array.each do |job_dependency| array_job_dependency = [] array_job_dependency << job_dependency.split('=>') array_job_dependency.each do |job, dependency| if dependency.nil?; dependency = '' else dependency.strip! end result_hash[job.strip] = dependency end end result_hash end end |