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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f0bb53bdbc623da087097264074c47c222d9ab6e
4
- data.tar.gz: 1101bfd58d2f18f34f5ede3921051fe7a38a760a
3
+ metadata.gz: 7fb46e247acf0646c4244899d168dd1cc0071aa4
4
+ data.tar.gz: e5520c2f153d78ce06664ac034bab8a9ffa51e47
5
5
  SHA512:
6
- metadata.gz: c9de14b8ec203392509baee6eee477dc556b9e693c4939ad7db35ef1dde161ecf354dd90ea85d59ab11f1967dcc8288e3fa90e3dd19d519dd411971a8872438e
7
- data.tar.gz: 6ce926069ff709433528540c92e2ba6a1e0b161d76a533659d96f12e9137f49518a8761aca9b01064b95b720cf9b5fc49e2c15bbbcd7287fe13e6f4b59b6a048
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 to_h
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
@@ -2,5 +2,5 @@
2
2
 
3
3
  module LazyLazer
4
4
  # The gem's semantic version number.
5
- VERSION = '0.5.0'
5
+ VERSION = '0.5.1'
6
6
  end
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.to_h
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.0
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-29 00:00:00.000000000 Z
11
+ date: 2017-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler