module Repunit
Constants
- VERSION
Public Class Methods
convert(repnum)
click to toggle source
# File lib/repunit.rb, line 7 def convert(repnum) rep1 = "1" * repnum.to_i repunit = rep1.to_i return repunit end
restore(repunit)
click to toggle source
# File lib/repunit.rb, line 12 def restore(repunit) return repunit.to_s.count('1') end