autobots 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cced0fc73b998d0e2c7ec8d62db5006e4e3191fd
4
- data.tar.gz: df8529087829518b6982070e58c443c779588fc9
3
+ metadata.gz: a5276029a0a189a4e7a067a5d47e7dbc5990eccd
4
+ data.tar.gz: eb89fab64980725b4e2502ccf67d63b1afd12f46
5
5
  SHA512:
6
- metadata.gz: 253704d48566fe2a4be8c11d2c3274b84045e739592baef54d80982539b73096fa270f1706918efa77f4c755ff95a6e855ba9ef884a5950c240d0a511041c92a
7
- data.tar.gz: 91cf503c5dc1136547588320aba92696320476b252a48796e3ff85bb7f603f67695839650a60576ab442eff784695e772eb688c069043dfcd3c1f74f9c5b1757
6
+ metadata.gz: 860b12863e969a7441f1f6afc87457cea2d48c5978f3ec7e9bd29d7e2e3e3f32a5ca08c7dcdf4e9389d32a775faf58179784e449519b126e779c5129e93719ca
7
+ data.tar.gz: d8d7efc2073ad9562c71089d3d9404a7ed38295ec2e74de19ae8b8548b7942c539a6e426685284787a2d6cf690c3c5df57eb2d59d3b8d241850a46174feac35e
@@ -1,15 +1,23 @@
1
1
  module Autobots
2
2
  module Helpers
3
3
  module Caching
4
+ extend ActiveSupport::Concern
5
+
4
6
  def initialize(_, options = {})
5
7
  super
6
- @cache = options[:cache]
8
+ self.cache = options[:cache] if options.has_key?(:cache)
9
+ end
10
+
11
+ def self.prepended(klass)
12
+ klass.class_eval do
13
+ class_attribute :cache
14
+ end
7
15
  end
8
16
 
9
17
  def data
10
18
  return @data if defined?(@data)
11
19
 
12
- if @cache
20
+ if cache
13
21
  key_proc = options.fetch(:cache_key) do
14
22
  method(:cache_key)
15
23
  end
@@ -19,7 +27,7 @@ module Autobots
19
27
  end
20
28
 
21
29
  # misses: { key => obj }
22
- @data = BulkCacheFetcher.new(@cache).fetch(identifiers) do |misses|
30
+ @data = BulkCacheFetcher.new(cache).fetch(identifiers) do |misses|
23
31
  roll_out(misses.values)
24
32
  end
25
33
  else
@@ -1,3 +1,3 @@
1
1
  module Autobots
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autobots
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Ching