Sha256: 1ad14c1b1d99a37590183b689439643dfe198c3acc5b651b264d5b323772046a

Contents?: true

Size: 471 Bytes

Versions: 26

Compression:

Stored size: 471 Bytes

Contents

module BubbleWrap
  module Reactor
    module Future

      # A future is a sugaring of a typical deferrable usage.
      def future arg, cb=nil, eb=nil, &blk
        arg = arg.call if arg.respond_to?(:call)

        if arg.respond_to?(:set_deferred_status)
          if cb || eb
            arg.callback(&cb) if cb
            arg.errback(&eb) if eb
          else
            arg.callback(&blk) if blk
          end
        end

        arg
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
bubble-wrap-1.9.7 motion/reactor/future.rb
bubble-wrap-1.9.6 motion/reactor/future.rb
bubble-wrap-1.9.5 motion/reactor/future.rb
bubble-wrap-1.9.4 motion/reactor/future.rb
bubble-wrap-1.9.3 motion/reactor/future.rb
bubble-wrap-1.9.2 motion/reactor/future.rb
bubble-wrap-1.9.1 motion/reactor/future.rb
bubble-wrap-1.9.0 motion/reactor/future.rb
bubble-wrap-1.8.0 motion/reactor/future.rb
bubble-wrap-1.7.1 motion/reactor/future.rb
bubble-wrap-1.7.0 motion/reactor/future.rb
bubble-wrap-1.6.0 motion/reactor/future.rb
bubble-wrap-1.6.0.rc1 motion/reactor/future.rb
bubble-wrap-1.5.0 motion/reactor/future.rb
bubble-wrap-1.5.0.rc1 motion/reactor/future.rb
bubble-wrap-1.4.0 motion/reactor/future.rb
bubble-wrap-1.3.0 motion/reactor/future.rb
bubble-wrap-1.3.0.osx motion/reactor/future.rb
bubble-wrap-1.2.0 motion/reactor/future.rb
bubble-wrap-1.2.0.pre motion/reactor/future.rb