super_callbacks 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/README.md +2 -2
- data/lib/super_callbacks.rb +1 -19
- data/lib/super_callbacks/version.rb +1 -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: 22e2f43cddcb768271ec74009deb2829526bdd27
|
4
|
+
data.tar.gz: 701e41c8e839ab61ad2df10a4f2566ddf048aabc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67f3d6b901dfece079d580f5379fbea181ebe9f03abe7f4a63fbcb6a71790f4c887852ac4c2e5fe8e17dfd6ac1c7f246b8ad8ae0eb82d54e16ed3b79551b8bcc
|
7
|
+
data.tar.gz: 33cb10f65c83656417940e2ec233081eab3108fdfcafe1c851a25d715f1c77dd235d721161399fd3e5437d44c21f15377d3321f789de2ac66116d52e7492191d
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.2.
|
1
|
+
2.2.10
|
data/README.md
CHANGED
@@ -285,7 +285,7 @@ foo_2.bar
|
|
285
285
|
# => 'bar!'
|
286
286
|
```
|
287
287
|
|
288
|
-
*Notice above that foo_1 and foo_2 both call the class-level callbacks, while they have independent (not-shared) instance-level callbacks defined
|
288
|
+
*Notice above that foo_1 and foo_2 both call the class-level callbacks, while they have independent (not-shared) instance-level callbacks defined. Order of execution is class-level first then instance-level, of which defined callbacks are then in order of first-come-first-serve.*
|
289
289
|
*Above uses `before`, but works similarly with `after`*
|
290
290
|
|
291
291
|
### Example 8 (Inherited Callbacks)
|
@@ -344,7 +344,7 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
344
344
|
|
345
345
|
## Changelog
|
346
346
|
|
347
|
-
* 1.0.
|
347
|
+
* 1.0.2 (2019-08-12)
|
348
348
|
* Cleaner code without explicitly calling `run_callbacks` anymore; done now because of ruby upgrade from 1.9 to 2.0+ which already supports `prepend`
|
349
349
|
* Supported both class and instance level callbacks
|
350
350
|
* Supported inherited callbacks
|
data/lib/super_callbacks.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
require 'super_callbacks/version'
|
2
2
|
|
3
3
|
module SuperCallbacks
|
4
|
-
VERSION = '1.0.0'.freeze
|
5
|
-
|
6
4
|
VALID_OPTION_KEYS = [:if].freeze
|
7
5
|
|
8
6
|
def self.included(base)
|
@@ -20,27 +18,11 @@ module SuperCallbacks
|
|
20
18
|
|
21
19
|
module Helpers
|
22
20
|
# (modified) File activesupport/lib/active_support/core_ext/hash/deep_merge.rb, line 18
|
23
|
-
def self.deep_merge_hashes(this_hash, other_hash, &block)
|
24
|
-
deep_merge_hashes!(this_hash.dup, other_hash, &block)
|
25
|
-
end
|
26
|
-
|
27
|
-
# (modified) File activesupport/lib/active_support/core_ext/hash/deep_merge.rb, line 23
|
28
|
-
def self.deep_merge_hashes!(this_hash, other_hash, &block)
|
29
|
-
this_hash.merge!(other_hash) do |key, this_val, other_val|
|
30
|
-
if this_val.is_a?(Hash) && other_val.is_a?(Hash)
|
31
|
-
self.deep_merge_hashes(this_val, other_val, &block)
|
32
|
-
elsif block_given?
|
33
|
-
block.call(key, this_val, other_val)
|
34
|
-
else
|
35
|
-
other_val
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
21
|
def self.deep_merge_hashes_and_combine_arrays(this_hash, other_hash, &block)
|
41
22
|
self.deep_merge_hashes_and_combine_arrays!(this_hash.dup, other_hash, &block)
|
42
23
|
end
|
43
24
|
|
25
|
+
# (modified) File activesupport/lib/active_support/core_ext/hash/deep_merge.rb, line 23
|
44
26
|
def self.deep_merge_hashes_and_combine_arrays!(this_hash, other_hash, &block)
|
45
27
|
this_hash.merge!(other_hash) do |key, this_val, other_val|
|
46
28
|
if this_val.is_a?(Hash) && other_val.is_a?(Hash)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: super_callbacks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jules Roman B. Polidario
|
@@ -109,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
109
|
version: '0'
|
110
110
|
requirements: []
|
111
111
|
rubyforge_project:
|
112
|
-
rubygems_version: 2.4.5.
|
112
|
+
rubygems_version: 2.4.5.5
|
113
113
|
signing_key:
|
114
114
|
specification_version: 4
|
115
115
|
summary: Allows `before` and `after` callbacks to any Class. Supports both class and
|