Sha256: e244da9105a07a2a9255885f590895cb0587900fdd7c5050d8785c18ea0473bd
Contents?: true
Size: 630 Bytes
Versions: 121
Compression:
Stored size: 630 Bytes
Contents
require "#{File.dirname(__FILE__)}/../dataflow" require 'net/http' include Dataflow # Be gentle running this one Thread.abort_on_exception = true local do |stream, branding_occurences, number_of_mentions| unify stream, Array.new(10) { Dataflow::Variable.new } stream.each {|s| Thread.new(s) {|v| unify v, Net::HTTP.get_response(URI.parse("http://www.cuil.com/search?q=#{rand(1000)}")).body } } Thread.new { unify branding_occurences, stream.map {|http_body| http_body.scan /cuil/ } } Thread.new { unify number_of_mentions, branding_occurences.map {|occurences| occurences.length } } puts number_of_mentions.inspect end
Version data entries
121 entries across 121 versions & 3 rubygems