Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/RubyLeetSpeak/string.rb

Instance Method Summary collapse

Instance Method Details

#LeetItObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/RubyLeetSpeak/string.rb', line 3

def LeetIt
	result= ""

	leet = Hash.new  
	leet["a"] = '4'  
	leet["b"] = '8'  
	leet["c"] = '¢'  
	leet["d"] = '|)'  
	leet["e"] = '3'  
	leet["f"] = '<'  
	leet["g"] = '9'  
	leet["h"] = '#'  
	leet["i"] = '1'  
	leet["j"] = '_/'  
	leet["k"] = '|<'  
	leet["l"] = '|_'  
	leet["m"] = '^^'  
	leet["n"] = '^'  
	leet["o"] = '0'  
	leet["p"] = '|>'  
	leet["q"] = '<|'  
	leet["r"] = '®'  
	leet["s"] = '5'  
	leet["t"] = '7'  
	leet["u"] = 'û'
	leet["v"] = '\/'
	leet["w"] = '><'
	leet["x"] = '><'
	leet["y"] = '¥'
	leet["z"] = '2'
	leet[" "] = ' '


	
	self.each_char do |c|
		result= result.to_s + (leet.has_key?(c) ? leet[c].to_s : c)
	end

	return result
end