class String def scramble (split //).sort_by { rand }.join end end class UnpredictableString < String def scramble (split //).sort_by { rand }.join end def inspect scramble.inspect end end str = UnpredictableString.new("this is a test.") puts str