active_tools 0.0.35 → 0.0.36

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: 036261047b11ed88976a1cfa00f1a262b4eb5348
4
- data.tar.gz: eed87911c09acbbee7edbe65042bba8c722bb660
3
+ metadata.gz: 5d599d581dac5166f36e4b607305fa5891d958ba
4
+ data.tar.gz: 55fb1d88e0ec5e3974d357e6d99a3df2d0ef34eb
5
5
  SHA512:
6
- metadata.gz: d7f515ffdac4fba954614550becf526add509b92234e9877965570693592555b1c6e36a3048880b44de97a54c50efc04810d0bbb9748ab4eaefad24f525cab43
7
- data.tar.gz: 558210deda20c3a546f8b861b5e9efd1f5aaa9e86aa8ed7e23d7453f2e889d9b4ee72322342baebece51a8c08d1a8ea20ca055ce7502ca25d098e6eeff556ea5
6
+ metadata.gz: d8b99b36d0c0024bee898599eda063fe0db6bcb38e02d69edfb811a36a3dbb629152e2cee7f900ce9fc52df15569553815e5c89cebe02907a16bcece4e1d0f36
7
+ data.tar.gz: d9251e91a3e6b6933574f04f6661891aa91074235acb2fb9b7cbe079f9121b43fc45f1f70158cc138e5258ee381661716f20f89374d98ab4a8001ed37c919eaa
@@ -3,7 +3,7 @@ module ActiveTools
3
3
  module CustomCounterCache
4
4
  module InstanceMethods
5
5
  def custom_counter_cache_after_create(assoc_name, reflection, assoc_mapping)
6
- if record = send(assoc_name)
6
+ if record = try(assoc_name)
7
7
  ActiveRecord::CustomCounterCache.digger(self, record, assoc_mapping) do |parent, cache_column, value|
8
8
  parent.class.update_counters(parent.id, cache_column => value)
9
9
  end
@@ -13,7 +13,7 @@ module ActiveTools
13
13
 
14
14
  def custom_counter_cache_before_destroy(assoc_name, reflection, assoc_mapping)
15
15
  unless destroyed_by_association && (destroyed_by_association.foreign_key.to_sym == reflection.foreign_key.to_sym)
16
- if (record = send(assoc_name)) && !self.destroyed?
16
+ if (record = try(assoc_name)) && !self.destroyed?
17
17
  ActiveRecord::CustomCounterCache.digger(self, record, assoc_mapping) do |parent, cache_column, value|
18
18
  parent.class.update_counters(parent.id, cache_column => -value)
19
19
  end
@@ -21,23 +21,23 @@ module ActiveTools
21
21
  else
22
22
  assoc_mapping = value
23
23
  end
24
- if (reflection = reflections[assoc_name.to_s])
25
- unless method_defined? :custom_counter_cache_after_create
26
- include ActiveRecord::CustomCounterCache::InstanceMethods
27
- end
24
+ reflection = reflections[assoc_name.to_s]
25
+
26
+ unless method_defined? :custom_counter_cache_after_create
27
+ include ActiveRecord::CustomCounterCache::InstanceMethods
28
+ end
28
29
 
29
- after_create lambda { |record|
30
- record.custom_counter_cache_after_create(assoc_name, reflection, assoc_mapping)
31
- }
30
+ after_create lambda { |record|
31
+ record.custom_counter_cache_after_create(assoc_name, reflection, assoc_mapping)
32
+ }
32
33
 
33
- before_destroy lambda { |record|
34
- record.custom_counter_cache_before_destroy(assoc_name, reflection, assoc_mapping)
35
- }
34
+ before_destroy lambda { |record|
35
+ record.custom_counter_cache_before_destroy(assoc_name, reflection, assoc_mapping)
36
+ }
36
37
 
37
- after_update lambda { |record|
38
- record.custom_counter_cache_after_update(assoc_name, reflection, assoc_mapping)
39
- }
40
- end
38
+ after_update lambda { |record|
39
+ record.custom_counter_cache_after_update(assoc_name, reflection, assoc_mapping)
40
+ }
41
41
  end
42
42
  end
43
43
  end
@@ -15,7 +15,7 @@ module ActiveTools
15
15
  end
16
16
  end
17
17
  else
18
- response = try(:send, method)
18
+ response = try(method)
19
19
  yield self, method, response, value
20
20
  if value.is_a?(Hash) && !response.nil?
21
21
  response.method_digger(value, &block)
@@ -27,7 +27,7 @@ module ActiveTools
27
27
  def cycle_call(method, &block)
28
28
  object = self
29
29
  export = []
30
- while object = object.try(:send, method)
30
+ while object = object.try(method)
31
31
  yield object if block_given?
32
32
  export << object
33
33
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveTools
2
- VERSION = "0.0.35"
2
+ VERSION = "0.0.36"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.35
4
+ version: 0.0.36
5
5
  platform: ruby
6
6
  authors:
7
7
  - Valery Kvon