Class: DataPipe::Jobs

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeJobs

Returns a new instance of Jobs.



70
71
72
73
# File 'lib/Jobs.rb', line 70

def initialize
  @hash = Hash.new
  @byName = Hash.new
end

Instance Attribute Details

#byNameObject (readonly)

Returns the value of attribute byName.



68
69
70
# File 'lib/Jobs.rb', line 68

def byName
  @byName
end

#hashObject (readonly)

Returns the value of attribute hash.



68
69
70
# File 'lib/Jobs.rb', line 68

def hash
  @hash
end

Instance Method Details

#call(path) ⇒ Object



77
78
79
80
81
82
83
84
85
86
# File 'lib/Jobs.rb', line 77

def call( path )
  if @hash[path].nil? then
    j = Job.new( path )
    @hash[path] = j
    @byName[j.name.downcase] = j
    j.run
           else
    @hash[path].call
  end
end