Rational
ruby/spec describes 31 methods in core/rational, and Metorex implements 31 of them. The parameters are what Method#parameters answers under Metorex.
Rational#%: implemented, parameters[[:req, :other]]. Returnsselfmodulootheras a real numeric (Integer, Float, or Rational).Rational#*: implemented, parameters[[:req]]. Returns the numeric product ofselfandother:Rational#**: implemented, parameters[[:req]]. Returnsselfraised to the powerexponent:Rational#+: implemented, parameters[[:req]]. Returns the sum ofselfandother:Rational#-: implemented, parameters[[:req]]. Returns the difference ofselfandother:Rational#/: implemented, parameters[[:req]]. Returns the quotient ofselfandother:Rational#<=>: implemented, parameters[[:req]]. Comparesselfandother.Rational#==: implemented, parameters[[:req]]. Returnstrueifratequalsobjectnumerically.Rational#abs: implemented, parameters[]. Returns the absolute value ofrat. An example calling it.Rational#ceil: implemented, parameters[[:opt, :digits]]. Returns the smallest number greater than or equal toratwith a precision ofndigitsdecimal digits (default: 0). An example calling it.Rational#denominator: implemented, parameters[]. Returns the denominator (always positive). An example calling it.Rational#div: implemented, parameters[[:req, :other]]. Returns the quotientself/otheras an integer (viafloor), using method/as defined in the subclass of Numeric. An example calling it.Rational#divmod: implemented, parameters[[:req, :other]]. Returns a 2-element array[q, r], whereq = (self/other).floor # Quotient. An example calling it.Rational#fdiv: implemented, parameters[[:req, :other]]. Performs division and returns the value as a Float. An example calling it.Rational#floor: implemented, parameters[[:opt, :digits]]. Returns the largest number less than or equal toratwith a precision ofndigitsdecimal digits (default: 0). An example calling it.Rational#hash: implemented, parameters[]. An example calling it.Rational#inspect: implemented, parameters[]. Returns the value as a string for inspection. An example calling it.Rational#integer?: implemented, parameters[]. Returnstrueifselfis an Integer. An example calling it.Rational#magnitude: implemented, parameters[]. Returns the absolute value ofrat. An example calling it.Rational#marshal_dump: implemented, parameters[].Rational#numerator: implemented, parameters[]. Returns the numerator. An example calling it.Rational#quo: implemented, parameters[[:req, :other]]. Returns the quotient ofselfandother: An example calling it.Rational#rationalize: implemented, parameters[[:rest, :limits]]. Returns a simpler approximation of the value if the optional argumentepsis given (rat-|eps| <= result <= rat+|eps|), self otherwise. An example calling it.Rational#remainder: implemented, parameters[[:req, :other]]. Returns the remainder after dividingselfbyother. An example calling it.Rational#round: implemented, parameters[[:opt, :digits]]. Returnsratrounded to the nearest value with a precision ofndigitsdecimal digits (default: 0). An example calling it.Rational#to_f: implemented, parameters[]. Returns the value as a Float. An example calling it.Rational#to_i: implemented, parameters[]. Returns the truncated value as an integer. An example calling it.Rational#to_r: implemented, parameters[]. Returns self. An example calling it.Rational#to_s: implemented, parameters[]. Returns the value as a string. An example calling it.Rational#truncate: implemented, parameters[[:opt, :digits]]. Returnsrattruncated (toward zero) to a precision ofndigitsdecimal digits (default: 0). An example calling it.Rational#zero?: implemented, parameters[]. Returnstrueifzerohas a zero value,falseotherwise. An example calling it.
The method summaries are the first sentences of Ruby's own documentation for each method, read from MRI 4.0.6's ri data. Ruby's documentation is distributed under Ruby's license.