active_delivery 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +8 -0
- data/lib/active_delivery/lines/base.rb +4 -0
- data/lib/active_delivery/lines/mailer.rb +2 -4
- data/lib/active_delivery/version.rb +1 -1
- 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: bf0893a54bb33c6986a1e9c1adacec5db7d27dc605aa6cd5a4468e44a4391903
|
4
|
+
data.tar.gz: 8e91ba5c32903a2b524e7c7f4eb1c2887b59d3f4bdf86a202325c61272cc7e4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f4b0e1f6b9474ee6c2dd35fd8d3e54b0d2caf2259863ed2d463c8e923df2d8cba19592c2540ffa383b00ee42dd377e9e5fc80c51a201ce6a25e8a86f6176222
|
7
|
+
data.tar.gz: 7e9989c46074b713044f3ae08e33523c81382c45bc14811c7c2d58d4d02dbba50a45bdef515a09386e7c439d55e983d1547f630e338329a9a169b3c4c6b9da59
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
+
## 0.4.2 (2020-04-28)
|
6
|
+
|
7
|
+
- Allow resolve mailer class with custom pattern ([@brovikov][])
|
8
|
+
|
5
9
|
## 0.4.1 (2020-04-22)
|
6
10
|
|
7
11
|
- Fixed TestDelivery fiber support. ([@pauldub](https://github.com/pauldub))
|
@@ -43,3 +47,4 @@ Initial version.
|
|
43
47
|
[@palkan]: https://github.com/palkan
|
44
48
|
[@curpeng]: https://github.com/curpeng
|
45
49
|
[@iBublik]: https://github.com/ibublik
|
50
|
+
[@brovikov]: https://github.com/brovikov
|
data/README.md
CHANGED
@@ -84,6 +84,14 @@ PostsNotifier.published(user, post).notify_later
|
|
84
84
|
|
85
85
|
P.S. Naming ("delivery") is inspired by Basecamp: https://www.youtube.com/watch?v=m1jOWu7woKM.
|
86
86
|
|
87
|
+
**NOTE**: You could specify Mailer class explicitly or by custom pattern, using resolver:
|
88
|
+
|
89
|
+
```ruby
|
90
|
+
class PostsDelivery < ActiveDelivery::Base
|
91
|
+
register_line :custom_mailer, ActiveDelivery::Lines::Mailer, resolver: ->(name) { CustomMailer }
|
92
|
+
end
|
93
|
+
```
|
94
|
+
|
87
95
|
Delivery also supports _parameterized_ calling:
|
88
96
|
|
89
97
|
```ruby
|
@@ -11,6 +11,7 @@ module ActiveDelivery
|
|
11
11
|
@id = id
|
12
12
|
@owner = owner
|
13
13
|
@options = options.tap(&:freeze)
|
14
|
+
@resolver = options[:resolver]
|
14
15
|
end
|
15
16
|
|
16
17
|
def dup_for(new_owner)
|
@@ -18,6 +19,7 @@ module ActiveDelivery
|
|
18
19
|
end
|
19
20
|
|
20
21
|
def resolve_class(name)
|
22
|
+
resolver&.call(name)
|
21
23
|
end
|
22
24
|
|
23
25
|
def notify?(method_name)
|
@@ -54,6 +56,8 @@ module ActiveDelivery
|
|
54
56
|
|
55
57
|
owner.superclass.public_send(handler_method)
|
56
58
|
end
|
59
|
+
|
60
|
+
attr_reader :resolver
|
57
61
|
end
|
58
62
|
end
|
59
63
|
end
|
@@ -9,9 +9,7 @@ module ActiveDelivery
|
|
9
9
|
class Mailer < Base
|
10
10
|
alias mailer_class handler_class
|
11
11
|
|
12
|
-
|
13
|
-
name.gsub(/Delivery$/, "Mailer").safe_constantize
|
14
|
-
end
|
12
|
+
DEFAULT_RESOLVER = ->(name) { name.gsub(/Delivery$/, "Mailer").safe_constantize }
|
15
13
|
|
16
14
|
def notify?(method_name)
|
17
15
|
mailer_class.action_methods.include?(method_name.to_s)
|
@@ -34,6 +32,6 @@ module ActiveDelivery
|
|
34
32
|
end
|
35
33
|
end
|
36
34
|
|
37
|
-
ActiveDelivery::Base.register_line :mailer, Mailer
|
35
|
+
ActiveDelivery::Base.register_line :mailer, Mailer, resolver: Mailer::DEFAULT_RESOLVER
|
38
36
|
end
|
39
37
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_delivery
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladimir Dementyev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-04-
|
11
|
+
date: 2020-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|