struct

Ruby::V4::Rational

Inherits Struct < Value < Object

Constructors

from_float(f : Float64) : self

Точное значение Float64 как рациональная дробь (по битам IEEE754): 0.5 → (1/2), 0.123456789 → (8895999182988127/72057594037927936).

Source
from_ratio(num : Int, den : Int) : self
Source
new(num : Int64, den : Int64)
Source

Instance methods

inspect

Returns an unambiguous and information-rich string representation of this object, typically intended for developers.

This method should usually not be overridden. It delegates to #inspect(IO) which can be overridden for custom implementations.

Also see #to_s.

Source
to_f
Source
to_s

Returns a nicely readable and concise string representation of this object, typically intended for users.

This method should usually not be overridden. It delegates to #to_s(IO) which can be overridden for custom implementations.

Also see #inspect.

Source
zero?
Source