Class: Mule::Job

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeJob

Returns a new instance of Job.



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

def initialize
  @workers = 1
  @events        = {
    :before_fork => Proc.new {},
    :after_fork  => Proc.new {}
  }
end

Instance Attribute Details

#eventsObject (readonly)

Returns the value of attribute events.



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

def events
  @events
end

#fileObject

Returns the value of attribute file.



3
4
5
# File 'lib/mule/job.rb', line 3

def file
  @file
end

#workersObject

Returns the value of attribute workers.



3
4
5
# File 'lib/mule/job.rb', line 3

def workers
  @workers
end

Instance Method Details

#after_fork(&block) ⇒ Object



18
19
20
# File 'lib/mule/job.rb', line 18

def after_fork(&block)
  @events[:after_fork] = block if block_given?
end

#before_fork(&block) ⇒ Object



14
15
16
# File 'lib/mule/job.rb', line 14

def before_fork(&block)
  @events[:before_fork] = block if block_given?
end