class String

Public Instance Methods

to_r() click to toggle source
# File lib/kgl/kmath.rb, line 34
def to_r
        (numerator,denominator)=self.split(/\//)
        if self.match(/\.|e/)
                return numerator.to_f.to_r/denominator.to_f.to_r
        else
                return Rational(numerator.to_i,denominator.to_i)
        end
end