asset_cloud 2.2.5 → 2.2.6

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
  SHA256:
3
- metadata.gz: 893b7f80adf628a9de0991dce7f9febe75c5a72766dc30c2493d9d38c6f229c0
4
- data.tar.gz: 668804b41b67252ef633ad568d2faeb79499fd97817b12686e4c0b8344a8aec1
3
+ metadata.gz: b8da870cd7f0377f18b1ae46d7a4e8e69c2e4549f224e28df123f565d9e454d3
4
+ data.tar.gz: 190fea72f1ef76ffa7aad5931324be4cfc172903f41826a1485c2e859fae50dc
5
5
  SHA512:
6
- metadata.gz: c25c855f466f47cfbc425f603e43c1e29d12398c24d65fd75be116c3bbf7f71127637c30092e077133c514404f9bfe3ed9af56baacf2044407076f99dcb83195
7
- data.tar.gz: 1e22a454de1001f1c696d5880134a4a91bf5abd33fe3490d6202fc0e2d698d6a2c1314c3bfb2019924a0e6a90c39bf622f9bfca9818a6f1f4cca692759443d02
6
+ metadata.gz: fb1dff12c4fb90328182f23c96daf17f3f9fddbc13c42dd569b0855545c4be0621aa8bd218c43fc57eb44716f27026e1ca703fea67cd214231ee654853decca6
7
+ data.tar.gz: e29ebc045b6eeac9705f5f758aca3fce768c6e9f8085ecc0502cbdecf1037621b504ab0c3c175f61e8faa912d16d5abef16f79c90941c02bbce865e8cc50cae1
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{asset_cloud}
5
- s.version = "2.2.5"
5
+ s.version = "2.2.6"
6
6
 
7
7
  s.authors = %w(Shopify)
8
8
  s.summary = %q{An abstraction layer around arbitrary and diverse asset stores.}
@@ -3,6 +3,17 @@ module AssetCloud
3
3
  extend ActiveSupport::Concern
4
4
 
5
5
  module ClassMethods
6
+ attr_writer :_callbacks
7
+
8
+ def inherited(child)
9
+ super if defined? super
10
+ child._callbacks = _callbacks.deep_dup.freeze
11
+ end
12
+
13
+ def _callbacks
14
+ @_callbacks ||= {}.freeze
15
+ end
16
+
6
17
  def callback_methods(*symbols)
7
18
  symbols.each do |method|
8
19
  define_callbacks(method)
@@ -23,12 +34,14 @@ module AssetCloud
23
34
 
24
35
  define_singleton_method(before) do |*callbacks, &block|
25
36
  callbacks << block if block_given?
26
- write_inheritable_array(before, callbacks)
37
+ callbacks = (_callbacks[before] || []) + callbacks
38
+ self._callbacks = _callbacks.merge(before => callbacks).freeze
27
39
  end
28
40
 
29
41
  define_singleton_method(after) do |*callbacks, &block|
30
42
  callbacks << block if block_given?
31
- write_inheritable_array(after, callbacks)
43
+ callbacks = (_callbacks[after] || []) + callbacks
44
+ self._callbacks = _callbacks.merge(after => callbacks).freeze
32
45
  end
33
46
  end
34
47
 
@@ -49,7 +62,7 @@ module AssetCloud
49
62
 
50
63
  result = case callback
51
64
  when Symbol
52
- self.send(callback, *args)
65
+ send(callback, *args)
53
66
  when Proc, Method
54
67
  callback.call(self, *args)
55
68
  else
@@ -65,7 +78,7 @@ module AssetCloud
65
78
  end
66
79
 
67
80
  def callbacks_for(symbol)
68
- self.class.send(symbol) || []
81
+ self.class._callbacks[symbol] || []
69
82
  end
70
83
  end
71
84
  end
@@ -14,9 +14,12 @@ module AssetCloud
14
14
  end
15
15
 
16
16
  module ClassMethods
17
- def validate(*validations, &block)
17
+ def validate(*extra_validations, &block)
18
+ validations = self._callbacks[:validate] || []
19
+ validations += extra_validations
18
20
  validations << block if block_given?
19
- write_inheritable_array(:validate, validations)
21
+
22
+ self._callbacks = _callbacks.merge(validate: validations.freeze).freeze
20
23
  end
21
24
  end
22
25
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asset_cloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.5
4
+ version: 2.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-05 00:00:00.000000000 Z
11
+ date: 2019-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport