class

Numbers::Rational

Inherits Reference < Object

should this be made struct?

Constructors

new(numerator : Int32, denominator : Int32)
Source

Class methods

[](i : Int32)
Source
[](s : String)
Source
eight
Source
five
Source
four
Source
nine
Source
seven
Source
three
Source
zero
Source

Instance methods

*(r : self)
Source
+(r : self)
Source
-(r : self)
Source
/(r : self)
Source
==(r : self)

Returns true if this reference is the same as other. Invokes same?.

Source
==(i : Int32)
Source
denominator
Source
negative?
Source
numerator
Source
to_i
Source
to_s(io : IO) : Nil

Appends a short String representation of this object which includes its class name and its object address.

class Person
  def initialize(@name : String, @age : Int32)
  end
end

Person.new("John", 32).to_s # => #<Person:0x10a199f20>
Source

Macros

define_bin_operations_with_integers(*bin_ops)
Source
define_rational_integers(hash_node)
Source