Class: RubyGS::TextGS

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_gs/text_gs.rb

Class Method Summary collapse

Class Method Details

.decode(text) ⇒ Object



9
10
11
# File 'lib/ruby_gs/text_gs.rb', line 9

def self.decode text
  text.chars.map { |c| text_table.key(c.ord) ? text_table.key(c.ord) : "" }.join
end

.encode(text) ⇒ Object



5
6
7
# File 'lib/ruby_gs/text_gs.rb', line 5

def self.encode text
  text.chars.map { |c| text_table[c] ? text_table[c].chr : c }.join
end