Top Level Namespace

Defined Under Namespace

Modules: Bsearch, Comparable, Enumerable, Find, Kernel, Rho, Rhodes, RhodesFramework, Rhom, Singleton Classes: Array, Bignum, Date, DateTime, DateTimeME, ERB, FalseClass, File, Fixnum, Hash, IO, Integer, NilClass, Numeric, Object, Rational, String, Symbol, Time, TrueClass

Constant Summary collapse

TRUE =
true
FALSE =
false
NIL =
nil
RUBY_VERSION =
"1.8.5"
VERSION =
"1.8.5"
TOPLEVEL_BINDING =
self

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.privateObject



329
330
331
# File 'lib/builtinME.rb', line 329

def private
    Object.private
end

.protectedObject



333
334
335
# File 'lib/builtinME.rb', line 333

def protected
    Object.protected
end

.publicObject



325
326
327
# File 'lib/builtinME.rb', line 325

def public
    Object.public
end

.to_sObject



321
322
323
# File 'lib/builtinME.rb', line 321

def to_s
    return "main"
end

Instance Method Details

#Rational(a, b = 1) ⇒ Object

Creates a Rational number (i.e. a fraction). a and b should be Integers:

Rational(1,3)           # -> 1/3

Note: trying to construct a Rational with floating point or real values produces errors:

Rational(1.1, 2.3)      # -> NoMethodError


31
32
33
34
35
36
37
# File 'lib/rationalME.rb', line 31

def Rational(a, b = 1)
  if a.kind_of?(Rational) && b == 1
    a
  else
    Rational.reduce(a, b)
  end
end