class PrettyProfanity::Sanitize

Public Instance Methods

L337(word) click to toggle source
# File src/pretty-profanity/sanitize.rb, line 30
def L337(word)
  letters = %w(4 B \( D 3 Ph 9 |-| 1 j |< L |V| |V 0 P Q R 5 7 U V VV >< '/ Z)
  word.split('').map { |letter, index|
    letters[letter.ord - 97]
  }.join
end
garbled(word) click to toggle source
# File src/pretty-profanity/sanitize.rb, line 17
def garbled(word)
  text = '$@!#%'
  word.length.times do |i|
    word[i] = text[rand(0..(text.length-1))]
  end
  word
end
hollow(word) click to toggle source
# File src/pretty-profanity/sanitize.rb, line 25
def hollow(word)
  word[1,word.length-2] = '*' * (word.length - 2)
  word
end
none(word) click to toggle source
# File src/pretty-profanity/sanitize.rb, line 5
def none(word)
  ''
end
piglatin(word) click to toggle source
# File src/pretty-profanity/sanitize.rb, line 37
def piglatin(word)
  if word.match(/^[aeiou]/)
    word + 'way'
  else
    word.gsub(/^([^aeiou]+)(.+)$/, '\2\1') + 'ay'
  end
end
star(word) click to toggle source
# File src/pretty-profanity/sanitize.rb, line 13
def star(word)
  '*' * word.length
end
vowels(word) click to toggle source
# File src/pretty-profanity/sanitize.rb, line 9
def vowels(word)
  word.gsub(/[aeiou]/, '*')
end