Permalink
Browse files

Changing how receive is used in a few places

  • Loading branch information...
1 parent 492632f commit f702c5765ec75864c41ceff2796eaa0ee9fdf00a @nate nate committed Mar 9, 2012
Showing with 8 additions and 8 deletions.
  1. +2 −2 spec/examples/channel_of_channels_spec.rb
  2. +6 −6 spec/examples/sieve_spec.rb
@@ -16,7 +16,7 @@
worker = Proc.new do |reqs|
loop do
- req = reqs.receive[0]
+ req, _ = reqs.receive
req.resultChan << req.args+1
end
end
@@ -33,7 +33,7 @@
it "should work with multiple workers" do
worker = Proc.new do |reqs|
loop do
- req = reqs.receive[0]
+ req, _ = reqs.receive
req.resultChan << req.args+1
end
end
@@ -24,7 +24,7 @@ def filter(in_channel, prime)
go! do
loop do
- i = in_channel.receive[0]
+ i, _ = in_channel.receive
out << i if (i % prime) != 0
end
end
@@ -38,7 +38,7 @@ def sieve
go! do
ch = generate
loop do
- prime = ch.receive[0]
+ prime, _ = ch.receive
out << prime
ch = filter(ch, prime)
end
@@ -59,7 +59,7 @@ def sieve
puts primes.receive[0]
else
loop do
- p = primes.receive[0]
+ p, _ = primes.receive
if p <= n
result << p
@@ -92,7 +92,7 @@ def sieve
go! do
loop do
- i = in_channel.receive[0]
+ i, _ = in_channel.receive
out << i if (i % prime) != 0
end
end
@@ -107,7 +107,7 @@ def sieve
ch = generate.call
loop do
- prime = ch.receive[0]
+ prime, _ = ch.receive
out << prime
ch = filtr.call(ch, prime)
end
@@ -128,7 +128,7 @@ def sieve
puts primes.receive[0]
else
loop do
- p = primes.receive[0]
+ p, _ = primes.receive
if p <= n
result << p

0 comments on commit f702c57

Please sign in to comment.