Module: Prime::MillerRabin::PrimeIntercept

Defined in:
lib/prime_miller_rabin.rb

Instance Method Summary collapse

Instance Method Details

#prime?(value, *args) ⇒ Boolean

Intercept the prime? method. By going right to MillerRabin we can produce a faster result.

Returns:

  • (Boolean)


94
95
96
# File 'lib/prime_miller_rabin.rb', line 94

def prime?(value, *args)
  args.first.instance_of?(Prime::MillerRabin) ? args.first.prime?(value) : super
end