Sha256: eeef07c56aaf7c1a2d8fc6e3d6b6b43df79290a0866bc41df599c8cd536fb98e

Contents?: true

Size: 733 Bytes

Versions: 3

Compression:

Stored size: 733 Bytes

Contents

require 'rest-more'
require 'eventmachine'
RestCore::EmHttpRequest # there might be a autoload bug?
                        # omitting this line would cause
                        # stack level too deep (SystemStackError)

RestCore::Builder.default_app = RestCore::Auto
facebook = RestCore::Facebook.new(:log_method => method(:puts))

EM.run{
  Fiber.new{
    fiber = Fiber.current
    result = {}
    facebook.get('4'){ |response|
      result[0] = response
      fiber.resume(result) if result.size == 2
    }
    puts "It's not blocking..."
    facebook.get('4'){ |response|
      result[1] = response
      fiber.resume(result) if result.size == 2
    }
    p Fiber.yield
    EM.stop
  }.resume
  puts "It's not blocking..."
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rest-more-1.0.2 example/multi.rb
rest-more-1.0.1 example/multi.rb
rest-more-1.0.0 example/multi.rb