lz_string 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/README.md +66 -1
 - data/lib/lz_string/version.rb +1 -1
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 4deb314dc56a99124ebd3b6f2cbf7c2606c53e72bbcc01ffd1dd1b300138c063
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: c563a44e9b4f999f8a129f0acd066fed1a05c1f9ecc2b171b5245fe5b3d652ac
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: b7f31cf34b11b9850ec6f49a11f067e9edf8073d1560953334a615a4bee7486ed2ba653c8129baae694f073e0343e22fbfcd86495f75c8848fce72bdd390238a
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: fc6e306345c9e16c46e8e07269aeeb7170c73b35d9ef484cb32a99ccc5b69e7ffc9599fdc76366a4646a51478664aef77d6a30314e24d685bd6c71fd93d2a1c2
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -1,2 +1,67 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # lz-string
         
     | 
| 
       2 
     | 
    
         
            -
            Ruby implementation of LZ-String compression algorithm
         
     | 
| 
      
 2 
     | 
    
         
            +
            Ruby implementation of [LZ-String](https://github.com/pieroxy/lz-string) compression algorithm.
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            Supports:
         
     | 
| 
      
 5 
     | 
    
         
            +
             * Raw compression
         
     | 
| 
      
 6 
     | 
    
         
            +
             * UTF-16 compression
         
     | 
| 
      
 7 
     | 
    
         
            +
             * Base64 compression
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            ### Installation
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            Install the latest release:
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            ```
         
     | 
| 
      
 14 
     | 
    
         
            +
            $ gem install lz_string
         
     | 
| 
      
 15 
     | 
    
         
            +
            ```
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            In Rails, add it to your Gemfile:
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 20 
     | 
    
         
            +
            gem 'lz_string'
         
     | 
| 
      
 21 
     | 
    
         
            +
            ```
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            ### How to use
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            #### Normal Compression and Decompression:
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
            ``` ruby
         
     | 
| 
      
 28 
     | 
    
         
            +
              # Compress
         
     | 
| 
      
 29 
     | 
    
         
            +
              compressed = LZString.compress("Hello world!")
         
     | 
| 
      
 30 
     | 
    
         
            +
              => "҅〶惶@✰Ӏ葀"
         
     | 
| 
      
 31 
     | 
    
         
            +
              
         
     | 
| 
      
 32 
     | 
    
         
            +
              # Decompress
         
     | 
| 
      
 33 
     | 
    
         
            +
              LZString.decompress(compressed)
         
     | 
| 
      
 34 
     | 
    
         
            +
              => "Hello world!"
         
     | 
| 
      
 35 
     | 
    
         
            +
            ```
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
            #### UTF-16 Compression and Decompression:
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
            ``` ruby
         
     | 
| 
      
 40 
     | 
    
         
            +
              some_string = '{"some": "json", "foo": [{"bar": "؋", "key": ""}], "ঞᕠ": "൱ඵቜ"}'
         
     | 
| 
      
 41 
     | 
    
         
            +
              
         
     | 
| 
      
 42 
     | 
    
         
            +
              # Compress
         
     | 
| 
      
 43 
     | 
    
         
            +
              compressed = LZString::UTF16.compress(some_string)
         
     | 
| 
      
 44 
     | 
    
         
            +
              => "ᯡࡓ䈌\u0B80匰ᜠр\u0AF2Ǹ䀺㈦イ\u0530්C¦¼䒨ᨬිnj〩痐࠸С㸢璑Ч䲤U⋴ҕ䈥㛢ĉ႙  "
         
     | 
| 
      
 45 
     | 
    
         
            +
              
         
     | 
| 
      
 46 
     | 
    
         
            +
              # Decompress
         
     | 
| 
      
 47 
     | 
    
         
            +
              LZString::UTF16.decompress(compressed)
         
     | 
| 
      
 48 
     | 
    
         
            +
              => "{\"some\": \"json\", \"foo\": [{\"bar\": \"؋\", \"key\": \"\"}], \"ঞᕠ\": \"൱ඵቜ\"}"
         
     | 
| 
      
 49 
     | 
    
         
            +
            ```
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
            #### Base64 Compression and Decompression:
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
            ``` ruby		
         
     | 
| 
      
 54 
     | 
    
         
            +
              # Compress
         
     | 
| 
      
 55 
     | 
    
         
            +
              compressed = LZString::Base64.compress("Hello world!")
         
     | 
| 
      
 56 
     | 
    
         
            +
              => "BIUwNmD2AEDukCcwBMCEQ==="
         
     | 
| 
      
 57 
     | 
    
         
            +
              
         
     | 
| 
      
 58 
     | 
    
         
            +
              # Decompress
         
     | 
| 
      
 59 
     | 
    
         
            +
              LZString::Base64.decompress(compressed)
         
     | 
| 
      
 60 
     | 
    
         
            +
              => "Hello world!"
         
     | 
| 
      
 61 
     | 
    
         
            +
            ```
         
     | 
| 
      
 62 
     | 
    
         
            +
             
         
     | 
| 
      
 63 
     | 
    
         
            +
            ### Tests
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
            ``` bash
         
     | 
| 
      
 66 
     | 
    
         
            +
            $ rake
         
     | 
| 
      
 67 
     | 
    
         
            +
            ```
         
     | 
    
        data/lib/lz_string/version.rb
    CHANGED