Method: Kernel#Integer
- Defined in:
- object.c
#Integer(arg) ⇒ Integer
Converts arg to a Fixnum or Bignum. Numeric types are converted directly (with floating point numbers being truncated). If arg is a String, leading radix indicators (0, 0b, and 0x) are honored. Others are converted using to_int and to_i. This behavior is different from that of String#to_i.
Integer(123.999) #=> 123
Integer("0x1a") #=> 26
Integer(Time.new) #=> 1049896590
2279 2280 2281 |
# File 'object.c', line 2279 static VALUE rb_f_integer(obj, arg) VALUE obj, arg; |