<commit_before>
require 'rest-core'
require 'eventmachine'

client = RestCore::Builder.client{
  use RC::DefaultSite, 'https://graph.facebook.com/'
  use RC::CommonLogger, method(:puts)
  use RC::JsonDecode, true
  run RC::EmHttpRequest
}.new

EM.run{
  Fiber.new{
    z = client.get('http://localhost:4331/very-slow')
    a = client.get(4)
    b = client.get(5)
    c = client.get(6){ |q| p q }
    p b
    EM.stop
  }.resume
}<commit_msg>example/future.rb: revisited<commit_after>
require 'rest-core'
require 'eventmachine'

client = RestCore::Builder.client{
  use RC::DefaultSite, 'https://graph.facebook.com/'
  use RC::CommonLogger, method(:puts)
  use RC::JsonDecode, true
  run RC::EmHttpRequest
}.new

EM.run{
  Fiber.new{
    r = []
    z = client.get('http://localhost:8080/very-slow') # not dependant
    a = client.get(4)                                 # not dependant
    b = client.get(5)
    c = client.get(6){ |q| r << p(q); EM.stop if r.size == 2 } # non-blocking
    r << p(b) # here it blocks because b is needed
    EM.stop if r.size == 2
  }.resume
}
{'fraction_non_alphanumeric': 0.16123019571295433, 'fraction_numerical': 0.014911463187325256, 'mean_word_length': 2.9197080291970803, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7011754', 'n_tokens_mistral': 400, 'n_tokens_neox': 387, 'n_words': 93}