Class: Mqjob::Config::Hooks

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Hooks

Returns a new instance of Hooks.



98
99
100
# File 'lib/mqjob.rb', line 98

def initialize(opts)
  update(opts)
end

Instance Attribute Details

#after_forkObject (readonly)

Returns the value of attribute after_fork.



96
97
98
# File 'lib/mqjob.rb', line 96

def after_fork
  @after_fork
end

#before_forkObject (readonly)

Returns the value of attribute before_fork.



96
97
98
# File 'lib/mqjob.rb', line 96

def before_fork
  @before_fork
end

#wrap_performObject (readonly)

Returns the value of attribute wrap_perform.



96
97
98
# File 'lib/mqjob.rb', line 96

def wrap_perform
  @wrap_perform
end

Instance Method Details

#update(opts) ⇒ Object



102
103
104
105
106
107
108
109
110
# File 'lib/mqjob.rb', line 102

def update(opts)
  return if opts.nil? || opts.empty?

  raise "hooks shuld be a Proc map!" unless opts.values.all?{|x| x.nil? || x.is_a?(Proc)}

  @before_fork = opts[:before_fork]
  @after_fork = opts[:after_fork]
  @wrap_perform = opts[:wrap_perform]
end