rationalize

int.rationalize([eps]) â rational Instance Public methods Returns the value as a rational. The optional argument eps is always ignored.

round

int.round([ndigits]) â integer or float Instance Public methods Rounds flt to a given precision in decimal digits (default 0 digits). Precision may be negative. Returns a floating point number when ndigits is positive, self for zero, and round down for negative. 1.round #=> 1 1.round(2) #=> 1.0 15.round(-1) #=> 20

succ

int.succ â integer Instance Public methods Returns the Integer equal to int + 1. 1.next #=> 2 (-1).next #=> 0

times

int.times {|i| block } â selfint.times â an_enumerator Instance Public methods Iterates block int times, passing in values from zero to int - 1. If no block is given, an enumerator is returned instead. 5.times do |i| print i, " " end produces: 0 1 2 3 4 each

to_bn

to_bn() Instance Public methods

to_d

int.to_d â bigdecimal Instance Public methods Convert int to a BigDecimal and return it. require 'bigdecimal' require 'bigdecimal/util' 42.to_d # => #<BigDecimal:1008ef070,'0.42E2',9(36)>

to_i

int.to_i â integerint.to_int â integer Instance Public methods As int is already an Integer, all these methods simply return the receiver.

to_int

int.to_int â integer Instance Public methods As int is already an Integer, all these methods simply return the receiver.

to_r

int.to_r â rational Instance Public methods Returns the value as a rational. 1.to_r #=> (1/1) (1<<64).to_r #=> (18446744073709551616/1)

truncate

int.truncate â integer Instance Public methods As int is already an Integer, all these methods simply return the receiver.