Class: DataPipe2::Jobs
- Inherits:
-
Object
- Object
- DataPipe2::Jobs
- Defined in:
- lib/jobs.rb
Overview
Hold all jobs
Instance Attribute Summary collapse
-
#byName ⇒ Object
readonly
Returns the value of attribute byName.
-
#hash ⇒ Object
readonly
Returns the value of attribute hash.
Instance Method Summary collapse
- #call(path) ⇒ Object
-
#initialize ⇒ Jobs
constructor
A new instance of Jobs.
Constructor Details
#initialize ⇒ Jobs
Returns a new instance of Jobs.
67 68 69 70 |
# File 'lib/jobs.rb', line 67 def initialize @hash = {} @by_name = {} end |
Instance Attribute Details
#byName ⇒ Object (readonly)
Returns the value of attribute byName.
65 66 67 |
# File 'lib/jobs.rb', line 65 def byName @byName end |
#hash ⇒ Object (readonly)
Returns the value of attribute hash.
65 66 67 |
# File 'lib/jobs.rb', line 65 def hash @hash end |
Instance Method Details
#call(path) ⇒ Object
72 73 74 75 76 77 78 79 80 81 |
# File 'lib/jobs.rb', line 72 def call(path) if @hash[path].nil? j = Job.new(path) @hash[path] = j @by_name[j.name.downcase] = j j.run else @hash[path].call end end |