embed_callbacks 0.1.3 → 1.0.0
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 +4 -4
- data/README.md +6 -6
- data/lib/embed_callbacks/behavior.rb +1 -1
- data/lib/embed_callbacks/condition.rb +2 -1
- data/lib/embed_callbacks/version.rb +1 -1
- data/lib/embed_callbacks.rb +1 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb4024b98fbb4162674d0e91eed1810871d8e4e461b187dac5351a76587fea31
|
4
|
+
data.tar.gz: 75d2896de526c3399ac32bddb5d0f1501fee2a81c0b1adf0712e9a3bf0223fd8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71dfcfe4ebdd14d12fd89b13961286a31aa5946ad5bcf0b26686282580403526acc5c1d26a38b7523631181912841813827ffb27ae9b9b6644888cbb05655d85
|
7
|
+
data.tar.gz: c30558309347cbee8462d8d06081900bb95c0fbaa9920ae5e5bde29bbe7ea4f5afc5518607d6f20e155011af270208d19cd646ffb75459add3808ab36513f2a1
|
data/README.md
CHANGED
@@ -41,7 +41,7 @@ require 'embed_callbacks'
|
|
41
41
|
|
42
42
|
class Sample
|
43
43
|
include EmbedCallbacks
|
44
|
-
|
44
|
+
embed_callback :target, :before, :before_callback
|
45
45
|
|
46
46
|
def target
|
47
47
|
puts 'target'
|
@@ -65,7 +65,7 @@ require 'embed_callbacks'
|
|
65
65
|
|
66
66
|
class Sample
|
67
67
|
include EmbedCallbacks
|
68
|
-
|
68
|
+
embed_callback :target, :after, :after_callback
|
69
69
|
|
70
70
|
def target
|
71
71
|
puts 'target'
|
@@ -89,7 +89,7 @@ require 'embed_callbacks'
|
|
89
89
|
|
90
90
|
class Sample
|
91
91
|
include EmbedCallbacks
|
92
|
-
|
92
|
+
embed_callback :target, :around, :around_callback
|
93
93
|
|
94
94
|
def target
|
95
95
|
puts 'target'
|
@@ -113,7 +113,7 @@ require 'embed_callbacks'
|
|
113
113
|
|
114
114
|
class Sample
|
115
115
|
include EmbedCallbacks
|
116
|
-
|
116
|
+
embed_callback :target, :rescue, :rescue_callback
|
117
117
|
|
118
118
|
def target
|
119
119
|
raise 'target'
|
@@ -138,7 +138,7 @@ require 'embed_callbacks'
|
|
138
138
|
|
139
139
|
class Sample
|
140
140
|
include EmbedCallbacks
|
141
|
-
|
141
|
+
embed_callback :target, :ensure, :ensure_callback
|
142
142
|
|
143
143
|
def target
|
144
144
|
puts 'target'
|
@@ -164,7 +164,7 @@ class Sample
|
|
164
164
|
include EmbedCallbacks
|
165
165
|
attr_accessor :check_flag
|
166
166
|
|
167
|
-
|
167
|
+
embed_callback :target, :before, :before_callback, if: ->(record) { record.check_flag }
|
168
168
|
|
169
169
|
def target
|
170
170
|
puts 'target'
|
data/lib/embed_callbacks.rb
CHANGED
@@ -8,7 +8,7 @@ module EmbedCallbacks
|
|
8
8
|
end
|
9
9
|
|
10
10
|
module PrependMethods
|
11
|
-
def
|
11
|
+
def embed_callback(target_method_name, behavior_sym, callback_function_name, **options)
|
12
12
|
behavior = Behavior.new(behavior_sym)
|
13
13
|
m = Module.new
|
14
14
|
m.define_method(target_method_name) do |*params|
|
@@ -28,5 +28,4 @@ module EmbedCallbacks
|
|
28
28
|
prepend m
|
29
29
|
end
|
30
30
|
end
|
31
|
-
|
32
31
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embed_callbacks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- hotoolong
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-01-
|
11
|
+
date: 2023-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|