Module: L33tify

Defined in:
lib/l33tify.rb,
lib/l33tify/version.rb

Constant Summary collapse

VERSION =
"0.0.3"

Class Method Summary collapse

Class Method Details

.process(str) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/l33tify.rb', line 4

def self.process(str)
  l33t_replacements = {i: '1', r: '2', e: '3', a: '4', s: '5', t: '7', o: '0'}

  str = str.downcase
  new_string = ''

  str.each_char do |c|
    if l33t_replacements[c.to_sym].nil? == false
      new_string += l33t_replacements[c.to_sym]
    else
      new_string += c
    end
  end

  return new_string
end