Sha256: 9263df62db980cc4da56ffd6a882280b26ce6147f8f8e467f21c0ddfea5bad66

Contents?: true

Size: 360 Bytes

Versions: 2

Compression:

Stored size: 360 Bytes

Contents

module EventMachine
  module Deferrable
    def map
      deferrable_result = EventMachine::DefaultDeferrable.new

      self.callback do |original_value|
        deferrable_result.succeed yield(original_value)
      end

      self.errback do |original_value|
        deferrable_result.fail original_value
      end

      deferrable_result
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
em-dextras-0.4.0 lib/em-dextras/extension/object/deferrable.rb
em-dextras-0.3.0 lib/em-dextras/extension/object/deferrable.rb