Class: Integer

Inherits:
Object show all
Defined in:
lib/rwd/ruby.rb

Instance Method Summary collapse

Instance Method Details

#octObject



76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/rwd/ruby.rb', line 76

def oct
  n	= self
  res	= []

  while n > 8
    n, x	= n.divmod(8)
    res << x
  end
  res << n

  res.reverse.join("")
end