roda-mailer_ext 0.1.0 → 0.2.0

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: 8dd5819628c0cdd98aa1ba6d494d0703afddb332
4
- data.tar.gz: bc0d720572692281273cbf4d21f447f83b47fdfb
3
+ metadata.gz: 75677215c1081e0a72b05714ec0bef150b56ceb9
4
+ data.tar.gz: 69fbec14349c54876264ecce6040eaafffe95d6a
5
5
  SHA512:
6
- metadata.gz: d53cedf87191c1163e78ce3af26a77728f6d86492ca913d6c9e956de6f9bb7faa948167fbd3c92e2646a1b507561cab80e05071de046cc29041864e5063b1295
7
- data.tar.gz: c2d7424846f6c6570cb13743abf942059eb2378efd347c1feb657406a840bfadba0668c0225999cc5f7d2e1bf388176e1bb7fd0796fc7eebfff9ce31ac047fa9
6
+ metadata.gz: a4fb322de633a19f32486c8ec422f881cc9710e4a8a856b320c313146c1dea5b0b17a5f020554078222880e672efbe7f07ceda92d5ca85179ee566649cb92033
7
+ data.tar.gz: b87e60117d50241b224e886e5f9099fe77bdd0749ef52fbbdfcb8c5da124c74165b9bf8b8091f6746787a52a6dd882fdb7aef26f08f84faf6b956dfaf7c7c400
data/README.md CHANGED
@@ -4,7 +4,7 @@ A few helpful extensions to the Roda mailer plugin.
4
4
 
5
5
  ## Installation
6
6
 
7
- Add this line ot your application's Gemfile:
7
+ Add this line to your application's Gemfile:
8
8
 
9
9
  ```ruby
10
10
  gem "roda-mailer_ext"
@@ -13,7 +13,9 @@ module Roda::RodaPlugins # :nodoc:
13
13
  #
14
14
  # The following plugin options are supported:
15
15
  #
16
- # :log :: Output the body of the email to STDOUT before delivery
16
+ # :log :: When true, output the body of the email to STDOUT before delivery.
17
+ # If passed an object that responds to +call+, it will be called with
18
+ # the email object.
17
19
  # :prevent_delivery :: Uses the +Mail+ test mailer instead of actually
18
20
  # attempting the delivery to a SMTP server.
19
21
  #
@@ -34,7 +36,17 @@ module Roda::RodaPlugins # :nodoc:
34
36
  end
35
37
 
36
38
  def _log_mail(message)
37
- puts <<~EOM
39
+ log = roda_class.opts[:mailer_ext][:log]
40
+
41
+ if log.respond_to?(:call)
42
+ log.call(message)
43
+ else
44
+ puts(_format_mail(message))
45
+ end
46
+ end
47
+
48
+ def _format_mail(message)
49
+ <<~EOM
38
50
 
39
51
  ==> Sending email to #{message.to.join(", ")}
40
52
  #{message}
@@ -52,7 +64,7 @@ module Roda::RodaPlugins # :nodoc:
52
64
  end
53
65
 
54
66
  def self.configure(app, opts = {}) # :nodoc:
55
- app.opts[:mailer_ext] = { log: false, prevent_delivery: false }.merge(opts).freeze
67
+ app.opts[:mailer_ext] = { log: false, prevent_delivery: false }.merge(opts)
56
68
 
57
69
  if app.opts[:mailer_ext][:prevent_delivery]
58
70
  Mail.defaults do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roda-mailer_ext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Daniels