lib/submodules/ably-ruby/lib/ably/modules/async_wrapper.rb in ably-rest-0.8.6 vs lib/submodules/ably-ruby/lib/ably/modules/async_wrapper.rb in ably-rest-0.8.9
- old
+ new
@@ -1,10 +1,10 @@
require 'eventmachine'
module Ably::Modules
# Provides methods to convert synchronous operations into async operations through the use of
- # {EventMachine#defer http://www.rubydoc.info/github/eventmachine/eventmachine/EventMachine#defer-class_method}.
+ # {http://www.rubydoc.info/github/eventmachine/eventmachine/EventMachine#defer-class_method EventMachine#defer}.
# The async_wrap method can only be called from within an EventMachine reactor, and must be thread safe.
#
# @note using this AsyncWrapper should only be used for methods that are used less frequently and typically
# not run with levels of concurrency due to the limited number of threads available to EventMachine by default.
# This module requires that the method #logger is defined.
@@ -40,10 +40,10 @@
#
def async_wrap(success_callback = nil)
raise ArgumentError, 'Block required' unless block_given?
Ably::Util::SafeDeferrable.new(logger).tap do |deferrable|
- deferrable.callback &success_callback if success_callback
+ deferrable.callback(&success_callback) if success_callback
operation_with_exception_handling = proc do
begin
yield
rescue StandardError => err