This is a Ruby tree! It shows every object from the Ruby Programming Language in a tree format.

Integer

        # Integer < Numeric

(from ruby core)
---


An Integer object represents an integer value.

You can create an Integer object explicitly with:

*   An [integer
    literal](doc/syntax/literals_rdoc.html#label-Integer+Literals).


You can convert certain objects to Integers with:

*   Method [Integer](Kernel.html#method-i-Integer).


An attempt to add a singleton method to an instance of this class causes
an exception to be raised.

## What's Here

First, what's elsewhere. Class Integer:

*   Inherits from [class
    Numeric](Numeric.html#class-Numeric-label-What-27s+Here).


Here, class Integer provides methods for:

*   [Querying](#class-Integer-label-Querying)
*   [Comparing](#class-Integer-label-Comparing)
*   [Converting](#class-Integer-label-Converting)
*   [Other](#class-Integer-label-Other)


### Querying

    #allbits?
:       Returns whether all bits in `self` are set.

    #anybits?
:       Returns whether any bits in `self` are set.

    #nobits?
:       Returns whether no bits in `self` are set.



### Comparing

    [<](#method-i-3C)
:       Returns whether `self` is less than the given value.

    [<=](#method-i-3C-3D)
:       Returns whether `self` is less than or equal to the given value.

    [<=>](#method-i-3C-3D-3E)
:       Returns a number indicating whether `self` is less than, equal
        to, or greater than the given value.

    [==](#method-i-3D-3D) (aliased as #===)
:       Returns whether `self` is equal to the given value.

    [>](#method-i-3E)
:       Returns whether `self` is greater than the given value.

    [>=](#method-i-3E-3D)
:       Returns whether `self` is greater than or equal to the given
        value.



### Converting

    ::sqrt
:       Returns the integer square root of the given value.

    ::try_convert
:       Returns the given value converted to an Integer.

    #% (aliased as #modulo)
:       Returns `self` modulo the given value.

    [&](#method-i-26)
:       Returns the bitwise AND of `self` and the given value.

    #*
:       Returns the product of `self` and the given value.

    [**](#method-i-2A-2A)
:       Returns the value of `self` raised to the power of the given
        value.

    #+
:       Returns the sum of `self` and the given value.

    #-
:       Returns the difference of `self` and the given value.

    [/](#method-i-2F)
:       Returns the quotient of `self` and the given value.

    #<<
:       Returns the value of `self` after a leftward bit-shift.

    #>>
:       Returns the value of `self` after a rightward bit-shift.

    #[]
:       Returns a slice of bits from `self`.

    [^](#method-i-5E)
:       Returns the bitwise EXCLUSIVE OR of `self` and the given value.

    #ceil
:       Returns the smallest number greater than or equal to `self`.

    #chr
:       Returns a 1-character string containing the character
        represented by the value of `self`.

    #digits
:       Returns an array of integers representing the base-radix digits
        of `self`.

    #div
:       Returns the integer result of dividing `self` by the given
        value.

    #divmod
:       Returns a 2-element array containing the quotient and remainder
        results of dividing `self` by the given value.

    #fdiv
:       Returns the Float result of dividing `self` by the given value.

    #floor
:       Returns the greatest number smaller than or equal to `self`.

    #pow
:       Returns the modular exponentiation of `self`.

    #pred
:       Returns the integer predecessor of `self`.

    #remainder
:       Returns the remainder after dividing `self` by the given value.

    #round
:       Returns `self` rounded to the nearest value with the given
        precision.

    #succ (aliased as #next)
:       Returns the integer successor of `self`.

    #to_f
:       Returns `self` converted to a Float.

    #to_s (aliased as #inspect)
:       Returns a string containing the place-value representation of
        `self` in the given radix.

    #truncate
:       Returns `self` truncated to the given precision.

    [/](#method-i-7C)
:       Returns the bitwise OR of `self` and the given value.



### Other

    #downto
:       Calls the given block with each integer value from `self` down
        to the given value.

    #times
:       Calls the given block `self` times with each integer in
        `(0..self-1)`.

    #upto
:       Calls the given block with each integer value from `self` up to
        the given value.



---
# Constants:

GMP_VERSION
:   The version of loaded GMP.



# Class methods:

    sqrt
    try_convert

# Instance methods:

    %
    &
    *
    **
    +
    -
    -@
    /
    <
    <<
    <=
    <=>
    ==
    ===
    >
    >=
    >>
    []
    ^
    abs
    allbits?
    anybits?
    bit_length
    ceil
    chr
    coerce
    denominator
    digits
    div
    divmod
    downto
    even?
    fdiv
    floor
    gcd
    gcdlcm
    inspect
    integer?
    lcm
    magnitude
    modulo
    next
    nobits?
    numerator
    odd?
    ord
    pow
    pred
    rationalize
    remainder
    round
    size
    succ
    times
    to_bn
    to_d
    to_f
    to_i
    to_int
    to_r
    to_s
    truncate
    upto
    zero?
    |
    ~

(from gem builder-3.2.4)
---
Enhance the Integer class with a XML escaped character conversion.
---
# Constants:

XChar
:   [not documented]


# Instance methods:

    xchr


      

This is MURDOC! A Ruby documentation browser inspired by Smalltalk-80. It allows you to learn about Ruby by browsing through its class hierarchies, and see any of its methods.