Mega Code Archive
Prefixed with the module name you can call the method from anywhere, as is the case with the Math module
#!/usr/bin/env ruby
module Binary
def Binary.to_bin( num )
bin = sprintf("%08b", num)
end
end
Binary.to_bin( 123 ) # => "01111011"