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

Version Path
engineyard-serverside-1.6.3 lib/vendor/dataflow/examples/dataflow_http_gets.rb
engineyard-serverside-1.5.35.pre.2 lib/vendor/dataflow/examples/dataflow_http_gets.rb
engineyard-serverside-1.5.35.pre.1 lib/vendor/dataflow/examples/dataflow_http_gets.rb
engineyard-serverside-1.5.33 lib/vendor/dataflow/examples/dataflow_http_gets.rb
engineyard-serverside-1.5.32 lib/vendor/dataflow/examples/dataflow_http_gets.rb
engineyard-serverside-1.6.0.pre5 lib/vendor/dataflow/examples/dataflow_http_gets.rb
engineyard-serverside-1.5.30 lib/vendor/dataflow/examples/dataflow_http_gets.rb
engineyard-serverside-1.6.0.pre4 lib/vendor/dataflow/examples/dataflow_http_gets.rb
engineyard-serverside-1.6.0.pre3 lib/vendor/dataflow/examples/dataflow_http_gets.rb
engineyard-serverside-1.6.0.pre2 lib/vendor/dataflow/examples/dataflow_http_gets.rb
engineyard-serverside-1.6.0.pre lib/vendor/dataflow/examples/dataflow_http_gets.rb
engineyard-serverside-1.5.29.pre3 lib/vendor/dataflow/examples/dataflow_http_gets.rb
engineyard-serverside-1.5.29.pre2 lib/vendor/dataflow/examples/dataflow_http_gets.rb
engineyard-serverside-1.5.29.pre1 lib/vendor/dataflow/examples/dataflow_http_gets.rb
engineyard-serverside-1.5.29.pre lib/vendor/dataflow/examples/dataflow_http_gets.rb
engineyard-serverside-1.5.29.pre.timestamps2 lib/vendor/dataflow/examples/dataflow_http_gets.rb
engineyard-serverside-1.5.29.pre.timestamps lib/vendor/dataflow/examples/dataflow_http_gets.rb
engineyard-serverside-1.5.28.pre.timestamps4 lib/vendor/dataflow/examples/dataflow_http_gets.rb
engineyard-serverside-1.5.28.pre.timestamps3 lib/vendor/dataflow/examples/dataflow_http_gets.rb
engineyard-serverside-1.5.28.pre.timestamps2 lib/vendor/dataflow/examples/dataflow_http_gets.rb