Sha256: 326cc0b7e1e50c613bb60a6c42af95e3e7cb90caa1b35f63a49aee1302f00533
Contents?: true
Size: 891 Bytes
Versions: 1
Compression:
Stored size: 891 Bytes
Contents
require 'rest-core' require 'eventmachine' RestCore::EmHttpRequest # there might be a autoload bug? # omitting this line would cause # stack level too deep (SystemStackError) YourClient = RestCore::Builder.client do s = RestCore use s::DefaultSite , 'https://api.github.com/users/' use s::JsonDecode , true use s::CommonLogger, method(:puts) use s::Cache , nil, 3600 run s::Auto end client = YourClient.new EM.run{ Fiber.new{ fiber = Fiber.current result = {} client.get('cardinalblue'){ |response| result[0] = response fiber.resume(result) if result.size == 2 } puts "It's not blocking..." client.get('cardinalblue'){ |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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rest-core-1.0.3 | example/multi.rb |