Prime.include?(1) hangs Ruby scripts and irb

Ruby version 1.8.6
Mac OS 10.5.2

I would like a Ruby script to do something if a result is a prime
number, or do something else if the result is not prime. But Ruby is
hanging on instance_of_Prime.includes?(some prime number). For example,
in irb:

$ irb

require ‘mathn’
=> true

foo=Prime.new
=> #<Prime:0x32bab8 @primes=[], @seed=1, @counts=[]>

puts foo.include?(2)
true
=> nil

puts foo.include?(1)

Expected:
false

Got:
Nothing, and programs won’t exit.

-------- Original-Nachricht --------

Datum: Thu, 15 Jan 2009 16:39:03 +0900
Von: Frisco Del R. [email protected]
An: [email protected]
Betreff: Prime.include?(1) hangs Ruby scripts and irb

=> true
Got:
Nothing, and programs won’t exit.

Hi –

I can confirm that behaviour on Ruby 1.8.7 and Ubuntu 8.04.
I think you should file a bug with the authors of mathn.

Best regards,

Axel

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs