Class: OmfRc::DeferredProcess
- Inherits:
-
Object
- Object
- OmfRc::DeferredProcess
- Includes:
- EM::Deferrable
- Defined in:
- lib/omf_rc/deferred_process.rb
Overview
To be used for handling long running processes
Instance Method Summary collapse
-
#fire(&block) ⇒ Object
Pass a block of long running process.
Instance Method Details
#fire(&block) ⇒ Object
Pass a block of long running process
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/omf_rc/deferred_process.rb', line 13 def fire(&block) raise ArgumentError, "Missing code block to be executed" if block.nil? EM.defer do begin result = block.call succeed result rescue => e fail e end end end |