Ruby Integer Functions
EditRocket provides the following information on Integer functions in the Ruby source code builder.
ceil - As int is already an Integer, all these methods simply return the receiver.
chr - Returns a string containing the ASCII character represented by the receiver's value.
denominator() - In an integer, the denominator is 1. Therefore, this method returns 1.
downto(limit) - Iterates block, passing decreasing values from int down to and including limit.
floor - As int is already an Integer, all these methods simply return the receiver.
from_prime_division(pd) -
gcd(other) - Returns the greatest common denominator of the two numbers (self and n).
gcd2(int) -
gcdlcm(other) - "Returns the GCD and the LCM (see #gcd and #lcm) of the two arguments (self and other). This is more efficient than calculating them separately."
induced_from(obj) - Convert obj to an Integer.
integer? - Always returns true.
lcm(other) - Returns the lowest common multiple (LCM) of the two arguments (self and other).
next - Returns the Integer equal to int + 1.
new -
numerator() - In an integer, the value is the numerator of its rational equivalent. Therefore, this method returns self.
prime_division() -
round - As int is already an Integer, all these methods simply return the receiver.
succ - Returns the Integer equal to int + 1.
times - Iterates block int times, passing in values from zero to int - 1.
to_i - As int is already an Integer, all these methods simply return the receiver.
to_int - As int is already an Integer, all these methods simply return the receiver.
to_r() - Returns a Rational representation of this integer.
to_yaml( opts = {} ) -
truncate - As int is already an Integer, all these methods simply return the receiver.
upto(limit) - Iterates block, passing in integer values from int up to and including limit.