Integer
Description
IntegerObject represents number objects which can bring into mathematical calculations.
1 + 1 # => 2
2 * 2 # => 4
Class Methods
Instance Methods
#
+ ( other )
( source )
#
-
Returns the subtraction of another Integer from self.
( source )
#
*
Returns self multiplying another Integer
( source )
#
**
Returns self squaring another Integer
( source )
#
/
Returns self divided by another Integer
( source )
#
>
Returns if self is larger than another Integer
( source )
#
>=
Returns if self is larger than or equals to another Integer
( source )
#
<
Returns if self is smaller than another Integer
( source )
#
<=
Returns if self is smaller than or equals to another Integer
( source )
#
<=>
Returns 1 if self is larger than the incoming Integer -1 if smaller. Otherwise 0.
( source )
#
==
Returns if self is equal to another Integer
( source )
#
!=
Returns if self is not equal to another Integer
( source )
#
++
Adds 1 to self and returns.
( source )
#
--
Substracts 1 from self and returns.
( source )
#
to_s
Returns a String
representation of self.
( source )
#
to_i
Returns self.
( source )
#
even
Returns if self is even.
( source )
#
odd
Returns if self is odd.
3.odd # => true
4.odd # => false
( source )
#
next
Returns self + 1.
( source )
#
pred
Returns self - 1.
( source )
#
times
Yields a block a number of times equals to self.
( source )
Returns the sum of self and another Integer