Module: Zombify::String::ZombifyHelper

Included in:
String
Defined in:
lib/zombify.rb

Instance Method Summary collapse

Instance Method Details

#zombify(real_word = 40) ⇒ Object



82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/zombify.rb', line 82

def zombify(real_word = 40)
  content = self.dup
  
  self.scan(/\w+/) do |word|
    if Kernel.rand(100) < real_word
      m = Zombify::undeadize(word)
      STDERR.puts m
      content.gsub!(word, m)
    else
      content.gsub!(word, Zombify::talk(1, word.length, word.length))
    end
  end
  content
end