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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 850016c54f7c39fe598abe0fd556b1aa6502decae5748c585a6d111723020c47
4
- data.tar.gz: 96bbad525cae17c66b59c07adc3ecf9db159f13906f31654f3b3ac4d86638d44
3
+ metadata.gz: bf0893a54bb33c6986a1e9c1adacec5db7d27dc605aa6cd5a4468e44a4391903
4
+ data.tar.gz: 8e91ba5c32903a2b524e7c7f4eb1c2887b59d3f4bdf86a202325c61272cc7e4c
5
5
  SHA512:
6
- metadata.gz: 9fc7815ba928c6ebc953bf762cbbf4af720c44d49a6f7a6496d49357059de9d3e05ffe23ec07f66084ba264d3aa18133290602e163810e0bc5986b12a4982b06
7
- data.tar.gz: 5e7ae24f11552849ad2fdc6fb1147c530817b5bded836302421d02f20719d85a19d2c05feaacf90d082ffa451ff406e354a803581aa473ecafb046c33d77089b
6
+ metadata.gz: 8f4b0e1f6b9474ee6c2dd35fd8d3e54b0d2caf2259863ed2d463c8e923df2d8cba19592c2540ffa383b00ee42dd377e9e5fc80c51a201ce6a25e8a86f6176222
7
+ data.tar.gz: 7e9989c46074b713044f3ae08e33523c81382c45bc14811c7c2d58d4d02dbba50a45bdef515a09386e7c439d55e983d1547f630e338329a9a169b3c4c6b9da59
@@ -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
- def resolve_class(name)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveDelivery
4
- VERSION = "0.4.1"
4
+ VERSION = "0.4.2"
5
5
  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.1
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-22 00:00:00.000000000 Z
11
+ date: 2020-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler