Module: Translator::NumberLang

Included in:
CatLang
Defined in:
lib/catspeak/translator.rb

Instance Method Summary collapse

Instance Method Details

#human_to_number(name, human_text) ⇒ Object

TODO: HumanLang class should be English instead. So that future lang can deal with Unicode languages



14
15
16
17
18
19
20
21
# File 'lib/catspeak/translator.rb', line 14

def human_to_number(name, human_text)
	number_text = human_text
	#number_text = Zlib::deflate(human_text, 1)
	number_text = Encrypter.encrypt(name, number_text)
	#number_text = Zlib::deflate(number_text, 1)
	number_text = number_text.bytes.to_a
	number_text
end

#number_to_human(name, number_text) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/catspeak/translator.rb', line 23

def number_to_human(name, number_text)
	human_text = ''
	number_text.each {|i| human_text = human_text + i.chr}
	#human_text = Zlib::inflate(human_text)
	human_text = Encrypter.decrypt(name,human_text)
	#human_text = Zlib::inflate(human_text)
	human_text
end