Class: LZString::UTF16
- Inherits:
-
Object
- Object
- LZString::UTF16
- Defined in:
- lib/lz_string/utf16.rb
Overview
UTF16 compressing algorithm.
Class Method Summary collapse
Class Method Details
.compress(input) ⇒ Object
5 6 7 8 9 |
# File 'lib/lz_string/utf16.rb', line 5 def self.compress(input) return "" if (input == nil) LZString::Base.compress(input, 15, lambda { |a| (a + 32).chr("UTF-8") }) + " " end |
.decompress(compressed) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/lz_string/utf16.rb', line 12 def self.decompress(compressed) return "" if (compressed == nil) return nil if (compressed == "") LZString::Base.decompress( compressed.length, 16384, lambda { |index| compressed[index].ord - 32 }, "UTF-8" ) end |