codegram / futuroscope

Yet another Futures implementation in Ruby
MIT License
210 stars 13 forks source link

Don't rely on `set` being required implicitly #10

Closed bayan closed 10 years ago

bayan commented 10 years ago

Many libraries (e.g. rails, rspec, etc) require set, but non rails applications don't by default.

The issue was encountered when I was experimenting with the library via a fresh ruby console (i.e. pry or irb).

$ irb
irb(main):001:0> require 'futuroscope'
=> true
irb(main):002:0> x = Futuroscope::Future.new{ sleep(1); 1 }
NameError: uninitialized constant Futuroscope::Pool::Set
    from /Users/bayan/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/futuroscope-0.1.5/lib/futuroscope/pool.rb:19:in `initialize'
    from /Users/bayan/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/futuroscope-0.1.5/lib/futuroscope.rb:11:in `new'
    from /Users/bayan/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/futuroscope-0.1.5/lib/futuroscope.rb:11:in `default_pool'
    from /Users/bayan/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/futuroscope-0.1.5/lib/futuroscope/future.rb:29:in `initialize'
    from (irb):2:in `new'
    from (irb):2
    from /Users/bayan/.rbenv/versions/2.0.0-p247/bin/irb:12:in `<main>'
irb(main):003:0> 
coveralls commented 10 years ago

Coverage Status

Coverage increased (+0.8%) when pulling 03f7a095fbd8a12478f9ab4162acdb4f94b4ea6e on bayan:master into acb9f95bfc0c823b4018a51a25b7e78f5cf5b6c9 on codegram:master.

txus commented 10 years ago

Good catch, thank you!