class Integer

Public Instance Methods

scramble(min = 10, max = 100) click to toggle source
# File lib/simplescrambler.rb, line 52
def scramble(min = 10, max = 100)
        if self.to_s.length == 1
                raise CannotScrambleNumberDigit
        elsif self.to_s.chars.count(self.to_s.chars[0]) == self.to_s.length
                raise CannotScrambleNumberSame
        elsif max.class != Integer || min.class != Integer
                raise NotNumber
        else
                return self.to_s.scramble(min, max).to_i
        end
end