Numeric
Try to convert obj into an Rational, using Kernel::Rational method. Returns converted Rational or nil if obj cannot be converted for any reason.
Rational
# File lib/try_convert.rb, line 25 def Rational.try_convert obj Rational(obj) rescue nil end