#!/bin/env ruby
require 'threadpool'
def time_taken
now = Time.now.to_f
yield
Time.now.to_f - now
end
def test_time_taken
pool_size = 5
pool = ThreadPool.new(pool_size)
elapsed = time_taken do
pool_size.times do
pool.schedule { sleep 1 }
end
pool.shutdown
end
assert_operator 4.5, :>, elapsed,
'Elapsed time was too long: %.1f seconds' % elapsed
end
test_time_taken
Este es el error
Traceback (most recent call last):
19: from /usr/local/bin/irb:23:in `<main>'
18: from /usr/local/bin/irb:23:in `load'
17: from /var/lib/gems/2.7.0/gems/irb-1.3.6/exe/irb:11:in `<top (required)>'
(irb):15:in `<main>': undefined local variable or method `wxit' for main:Object (NameError)