S. Robert James wrote:

> I'd like to be able to do:
> 
> x = 2.0
> assert x.integral?
> 
> the :integer method returns false in this case.
> What would be a good way to write a different method to check?

That depends on what you are trying to accomplish. Are you trying to
establish that the value is an integer expressed as a float?

--------------------------------------------

#!/usr/bin/ruby -w

def integer_in_sheeps_clothing?(v)
  return v.to_i == v
end

puts integer_in_sheeps_clothing?(5.0)

puts integer_in_sheeps_clothing?(5.0 + 1e-10)

--------------------------------------------

Output:

true
false

-- 
Paul Lutus
http://www.arachnoid.com