Module: Resque::Reports::Extensions::EventCallbacks::ClassMethods

Defined in:
lib/resque/reports/extensions/event_callbacks.rb

Overview

TODO: сделать гибкой логику колбеков и хендлеров Defines callbacks

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#error_callbackObject (readonly)

Returns the value of attribute error_callback.



11
12
13
# File 'lib/resque/reports/extensions/event_callbacks.rb', line 11

def error_callback
  @error_callback
end

#progress_callbackObject (readonly)

Returns the value of attribute progress_callback.



11
12
13
# File 'lib/resque/reports/extensions/event_callbacks.rb', line 11

def progress_callback
  @progress_callback
end

Instance Method Details

#on_error {|error| ... } ⇒ Object

Set callback on error

Yields:

  • (error)

    block to be executed when error occurred

Yield Parameters:

  • error (Exception)


28
29
30
# File 'lib/resque/reports/extensions/event_callbacks.rb', line 28

def on_error(&block)
  @error_callback = block
end

#on_progress {|progress| ... } ⇒ Object

Set callback for watching progress of export

Yields:

  • (progress)

    block to be executed on progress

Yield Parameters:

  • progress (Integer)

    current progress

  • total (Integer)

    data length



21
22
23
# File 'lib/resque/reports/extensions/event_callbacks.rb', line 21

def on_progress(&block)
  @progress_callback = block
end