http_store 0.3.15 → 0.3.16
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/Gemfile.lock +1 -1
 - data/lib/http_store/helpers/storable.rb +10 -3
 - data/lib/http_store/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: 65a49997a9d1583a1ea4d2b2e9e4eb133afe174a6c1db1b301f756897e33ab38
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 8dd16df5450d657e0c82b65e34a18b19360dcbe4cc8a5f1e4a500077b71487d6
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 398000288fe794bba74b4d0b6c9ef6c83ca44278dd895f43afc88293909365a17c5cb3cef058491a7ac3d0430b19760223558dbed5924b690f42878b45935e81
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: aa3cce3e5505bb6714d639e2f7062c6f514bfef1d1a1fd1640e925c125daa0127bb5243b5b79714e3952963fc39f443fa2c733cc58326ffba626dd430a8d9d0a
         
     | 
    
        data/Gemfile.lock
    CHANGED
    
    
| 
         @@ -36,7 +36,10 @@ module HttpStore 
     | 
|
| 
       36 
36 
     | 
    
         | 
| 
       37 
37 
     | 
    
         
             
                  def gen_storable_meta
         
     | 
| 
       38 
38 
     | 
    
         
             
                    @meta.slice(*HttpStore::STORE_KEYS).map do |k, v|
         
     | 
| 
       39 
     | 
    
         
            -
                       
     | 
| 
      
 39 
     | 
    
         
            +
                      storable_v = storable(v)
         
     | 
| 
      
 40 
     | 
    
         
            +
                      storable_v = storable_v.to_json[0..STRING_LIMIT_SIZE] if v.is_a?(Hash) || v.is_a?(Array)
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
                      [k, storable_v]
         
     | 
| 
       40 
43 
     | 
    
         
             
                    end.to_h
         
     | 
| 
       41 
44 
     | 
    
         
             
                  end
         
     | 
| 
       42 
45 
     | 
    
         | 
| 
         @@ -50,12 +53,16 @@ module HttpStore 
     | 
|
| 
       50 
53 
     | 
    
         
             
                      json = JSON.parse(value) rescue nil
         
     | 
| 
       51 
54 
     | 
    
         
             
                      json ? storable(json) : storable_string(value)
         
     | 
| 
       52 
55 
     | 
    
         
             
                    else
         
     | 
| 
       53 
     | 
    
         
            -
                      value 
     | 
| 
      
 56 
     | 
    
         
            +
                      value
         
     | 
| 
       54 
57 
     | 
    
         
             
                    end
         
     | 
| 
       55 
58 
     | 
    
         
             
                  end
         
     | 
| 
       56 
59 
     | 
    
         | 
| 
       57 
60 
     | 
    
         
             
                  def storable_string(str)
         
     | 
| 
       58 
     | 
    
         
            -
                    str. 
     | 
| 
      
 61 
     | 
    
         
            +
                    if str.encoding.name == "UTF-8"
         
     | 
| 
      
 62 
     | 
    
         
            +
                      str.length > STRING_LIMIT_SIZE ? { digest: Digest::SHA1.hexdigest(str), origin: str[0..1000] } : str
         
     | 
| 
      
 63 
     | 
    
         
            +
                    else
         
     | 
| 
      
 64 
     | 
    
         
            +
                      { digest: Digest::SHA1.hexdigest(str) }
         
     | 
| 
      
 65 
     | 
    
         
            +
                    end
         
     | 
| 
       59 
66 
     | 
    
         
             
                  end
         
     | 
| 
       60 
67 
     | 
    
         | 
| 
       61 
68 
     | 
    
         
             
                  def json_safe_parse(str)
         
     | 
    
        data/lib/http_store/version.rb
    CHANGED