Class: Mqjob::Config::Hooks
- Inherits:
-
Object
- Object
- Mqjob::Config::Hooks
- Defined in:
- lib/mqjob.rb
Instance Attribute Summary collapse
-
#after_fork ⇒ Object
readonly
Returns the value of attribute after_fork.
-
#before_fork ⇒ Object
readonly
Returns the value of attribute before_fork.
-
#wrap_perform ⇒ Object
readonly
Returns the value of attribute wrap_perform.
Instance Method Summary collapse
-
#initialize(opts) ⇒ Hooks
constructor
A new instance of Hooks.
- #update(opts) ⇒ Object
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_fork ⇒ Object (readonly)
Returns the value of attribute after_fork.
96 97 98 |
# File 'lib/mqjob.rb', line 96 def after_fork @after_fork end |
#before_fork ⇒ Object (readonly)
Returns the value of attribute before_fork.
96 97 98 |
# File 'lib/mqjob.rb', line 96 def before_fork @before_fork end |
#wrap_perform ⇒ Object (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 |