gossiper 0.3.7 → 0.3.8

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: 2c585e237731d8b16b854dfd76392d0b226be835
4
- data.tar.gz: 979ea4a3966ab9d773cd89ce165d7124e5ecd646
3
+ metadata.gz: 73d578f1c535eaaeb002558c0bc74a6592a8e22a
4
+ data.tar.gz: e995e9d05e66af43cb77b139800cdb6beeca455d
5
5
  SHA512:
6
- metadata.gz: adce6d4374325e793bd00994b90a819e715abee50638274a2a40bb03598d396fe245f2842d0c20951eb57d702d3d7adae38e12d144096bc92088fe99a71782e2
7
- data.tar.gz: cad8e31d7b783aa715c67bc40fe0adc45d45b10474a19aa4b792a2607510c9eb2d0c646c51ee0e8bb9ca1b04c04a771d3c81ac294c442d02339f3032949e37e7
6
+ metadata.gz: 61111ed23a1ecc731148d0b843a539b98b1df9252f97f464bcc960daaf0e6361b9e3c7087db2e1a4ed86b3dde6489a69444ad745b1962127a16ad1564dace9c2
7
+ data.tar.gz: f1352ee94b7709766a79c986888e6d1d97faca01c30fd40da80a7045f416b412b9162b71f12a4e69fc3c1848ca55eacdf591ae9867e4a55d83f36b61ee15ac36
@@ -0,0 +1,12 @@
1
+ module Gossiper
2
+ class ClassResolver
3
+
4
+ def resolve(notification_type)
5
+ klass = notification_type.split('_').map do |v|
6
+ v.titleize
7
+ end.join('')
8
+ "Notifications::#{klass}Notification"
9
+ end
10
+
11
+ end
12
+ end
@@ -36,13 +36,7 @@ module Gossiper
36
36
  end
37
37
 
38
38
  def config
39
- begin
40
- klass = "Notifications::#{kind.classify}Notification"
41
- klass.constantize.new(self)
42
- rescue NameError
43
- klass = Gossiper.configuration.default_notification_config_class
44
- klass.constantize.new(self)
45
- end
39
+ ClassResolver.new.resolve(kind).constantize.new(self)
46
40
  end
47
41
 
48
42
  def method_missing(method, *args, &block)
@@ -55,17 +49,14 @@ module Gossiper
55
49
  end
56
50
 
57
51
  protected
58
- def mail
59
- Gossiper::Mailer.mail_for(self)
60
- end
61
-
62
- def update_delivered_at!
63
- self.delivered_at = Time.now
64
- save!
65
- end
66
-
67
-
52
+ def mail
53
+ Gossiper::Mailer.mail_for(self)
54
+ end
68
55
 
56
+ def update_delivered_at!
57
+ self.delivered_at = Time.now
58
+ save!
59
+ end
69
60
 
70
61
  end
71
62
  end
@@ -1,3 +1,3 @@
1
1
  module Gossiper
2
- VERSION = "0.3.7"
2
+ VERSION = "0.3.8"
3
3
  end
data/lib/gossiper.rb CHANGED
@@ -5,6 +5,7 @@ require "gossiper/email_config"
5
5
  require "gossiper/mailer"
6
6
  require "gossiper/configuration"
7
7
  require "gossiper/notification_decorator"
8
+ require "gossiper/class_resolver"
8
9
 
9
10
  module Gossiper
10
11
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gossiper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 0.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcelo Jacobus
@@ -222,6 +222,7 @@ files:
222
222
  - lib/gossiper/concerns/decorators/notification.rb
223
223
  - lib/gossiper/concerns/models/notification.rb
224
224
  - lib/gossiper/mailer.rb
225
+ - lib/gossiper/class_resolver.rb
225
226
  - lib/gossiper/notification_decorator.rb
226
227
  - lib/gossiper/configuration.rb
227
228
  - lib/gossiper/version.rb