class Numbers::Rational

Overview

should this be made struct?

Defined in:

rational.cr

Constructors

Class Method Summary

Instance Method Summary

Macro Summary

Constructor Detail

def self.new(numerator : Int32, denominator : Int32) #

[View source]

Class Method Detail

def self.[](i : Int32) #

[View source]
def self.[](s : String) #

[View source]
def self.eight #

[View source]
def self.five #

[View source]
def self.four #

[View source]
def self.nine #

[View source]
def self.one #

[View source]
def self.seven #

[View source]
def self.six #

[View source]
def self.three #

[View source]
def self.two #

[View source]
def self.zero #

[View source]

Instance Method Detail

def *(r : self) #

[View source]
def *(i : Int32) #

[View source]
def +(r : self) #

[View source]
def +(i : Int32) #

[View source]
def -(r : self) #

[View source]
def -(i : Int32) #

[View source]
def - #

[View source]
def /(r : self) #

[View source]
def /(i : Int32) #

[View source]
def ==(r : self) #
Description copied from class Reference

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


[View source]
def ==(i : Int32) #

[View source]
def den : Int32 #

[View source]
def denominator : Int32 #

[View source]
def negative? #

[View source]
def num : Int32 #

[View source]
def numerator : Int32 #

[View source]
def to_i #

[View source]
def to_s(io : IO) : Nil #
Description copied from class Reference

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>

[View source]

Macro Detail

macro define_bin_operations_with_integers(*bin_ops) #

[View source]
macro define_rational_integers(hash_node) #

[View source]