rat.to_r â self Instance Public methods Returns self. Rational(2).to_r #=> (2/1) Rational(-8, 6).to_r #=> (-4/3)
rat.to_s â string Instance Public methods Returns the value as a string. Rational(2).to_s #=> "2/1" Rational(-8, 6).to_s #=> "-4/3" Rational('1/2').to_s #=> "1/2"
rat.truncate â integerrat.truncate(precision=0) â rational Instance Public methods Returns the truncated value (toward zero). Rational(3).truncate #=> 3 Rational(2, 3).truncate #=> 0 Rational(-3, 2).truncate #=> -1 decimal - 1 2 3 . 4 5 6 ^ ^ ^ ^ ^ ^ precision -3 -2 -1 0 +1 +2 '%f' % Rational('-123.456').truncate(+1) #=> "-123.400000" '%f' % Rational('-123.456').truncate(-1) #=>
_warn_() Class Public methods
const_missing(name) Class Public methods
method_missing(*args, &block) Class Public methods
respond_to_missing?(*args, &block) Class Public methods
new(text, old_name, new_name, comment, singleton = false) Class Public methods Creates a new Alias with a token stream of text that aliases old_name to new_name, has comment and is a singleton context.
<=>(other) Instance Public methods Order by singleton then new_name
aref() Instance Public methods HTML fragment reference for this alias
Page 863 of 11844