lazy_lazer 0.5.0 → 0.5.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/lib/lazy_lazer/internal_model.rb +6 -1
 - data/lib/lazy_lazer/version.rb +1 -1
 - data/lib/lazy_lazer.rb +13 -1
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 7fb46e247acf0646c4244899d168dd1cc0071aa4
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: e5520c2f153d78ce06664ac034bab8a9ffa51e47
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: c82968d52509e29b0cef1afe8be25ffab2bf6a4230bfcf5237986dbcf27c03b71d051f3061e83b73953bbdd5323b3363a0319aa00e1a561bef94a0b118cc4ab3
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 6bb1896b4df5936b43b88bd9d99200384fad86951a3f37bdda6742678e1629e61216e8ae42f9892bdfafef0b350b770a4119fa5e5d50a101a75b793a599fdd3f
         
     | 
| 
         @@ -25,11 +25,16 @@ module LazyLazer 
     | 
|
| 
       25 
25 
     | 
    
         | 
| 
       26 
26 
     | 
    
         
             
                # Converts all unconverted keys and packages them as a hash.
         
     | 
| 
       27 
27 
     | 
    
         
             
                # @return [Hash] the converted hash
         
     | 
| 
       28 
     | 
    
         
            -
                def  
     | 
| 
      
 28 
     | 
    
         
            +
                def parent_to_h
         
     | 
| 
       29 
29 
     | 
    
         
             
                  todo = @key_metadata.keys - @cache_hash.keys
         
     | 
| 
       30 
30 
     | 
    
         
             
                  todo.each_with_object(@cache_hash) { |key, cache| cache[key] = load_key_from_source(key) }.dup
         
     | 
| 
       31 
31 
     | 
    
         
             
                end
         
     | 
| 
       32 
32 
     | 
    
         | 
| 
      
 33 
     | 
    
         
            +
                # @return [Array<Symbol>] the locally processed and cached keys
         
     | 
| 
      
 34 
     | 
    
         
            +
                def cached_keys
         
     | 
| 
      
 35 
     | 
    
         
            +
                  @cache_hash.keys
         
     | 
| 
      
 36 
     | 
    
         
            +
                end
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
       33 
38 
     | 
    
         
             
                # Get the value of a key (fetching it from the cache if possible)
         
     | 
| 
       34 
39 
     | 
    
         
             
                # @param key_name [Symbol] the name of the key
         
     | 
| 
       35 
40 
     | 
    
         
             
                # @return [Object] the returned value
         
     | 
    
        data/lib/lazy_lazer/version.rb
    CHANGED
    
    
    
        data/lib/lazy_lazer.rb
    CHANGED
    
    | 
         @@ -79,7 +79,13 @@ module LazyLazer 
     | 
|
| 
       79 
79 
     | 
    
         
             
                # Converts all the attributes that haven't been converted yet and returns the final hash.
         
     | 
| 
       80 
80 
     | 
    
         
             
                # @return [Hash] a hash representation of the model
         
     | 
| 
       81 
81 
     | 
    
         
             
                def to_h
         
     | 
| 
       82 
     | 
    
         
            -
                  @_lazer_model. 
     | 
| 
      
 82 
     | 
    
         
            +
                  @_lazer_model.parent_to_h
         
     | 
| 
      
 83 
     | 
    
         
            +
                end
         
     | 
| 
      
 84 
     | 
    
         
            +
             
     | 
| 
      
 85 
     | 
    
         
            +
                # @return [String] a human-friendly view of the model
         
     | 
| 
      
 86 
     | 
    
         
            +
                def inspect
         
     | 
| 
      
 87 
     | 
    
         
            +
                  "#<#{self.class.name} (#{fully_loaded? ? 'loaded' : 'unloaded'}): [" + \
         
     | 
| 
      
 88 
     | 
    
         
            +
                    (@_lazer_model.cached_keys + @_lazer_writethrough.keys).join(', ') + ']>'
         
     | 
| 
       83 
89 
     | 
    
         
             
                end
         
     | 
| 
       84 
90 
     | 
    
         | 
| 
       85 
91 
     | 
    
         
             
                # Reload the object. Calls {#lazer_reload}, then merges the results into the internal store.
         
     | 
| 
         @@ -146,5 +152,11 @@ module LazyLazer 
     | 
|
| 
       146 
152 
     | 
    
         
             
                def fully_loaded!
         
     | 
| 
       147 
153 
     | 
    
         
             
                  @_lazer_loaded = true
         
     | 
| 
       148 
154 
     | 
    
         
             
                end
         
     | 
| 
      
 155 
     | 
    
         
            +
             
     | 
| 
      
 156 
     | 
    
         
            +
                # Mark the model as not fully loaded.
         
     | 
| 
      
 157 
     | 
    
         
            +
                # @return [void]
         
     | 
| 
      
 158 
     | 
    
         
            +
                def not_fully_loaded!
         
     | 
| 
      
 159 
     | 
    
         
            +
                  @_lazer_loaded = false
         
     | 
| 
      
 160 
     | 
    
         
            +
                end
         
     | 
| 
       149 
161 
     | 
    
         
             
              end
         
     | 
| 
       150 
162 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: lazy_lazer
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.5. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.5.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Avinash Dwarapu
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2017-09- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2017-09-30 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bundler
         
     |