notification-pusher 1.0.0.beta9 → 1.0.0.beta10

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: c7bd278a400f98567d17b9e39887e5e8960ddbfd99b9c2ad9edb6a462cf12f7c
4
- data.tar.gz: bcd25f7e997fae9a09a75cec3b8994bacd4ba15c7500b786db314efff13b3f81
3
+ metadata.gz: 85507c35f9a208143b6c60d0619a2451ee338ff647bf387d6a35d68d710013df
4
+ data.tar.gz: 10a5c1cf5effbc81e8307afcc28d18f32e453a1a6bf644e8c6efcd9bac7d3d1b
5
5
  SHA512:
6
- metadata.gz: 9188a46b341e911a926f67256f9ce958bc4fa20bd2dca0fd6d1dffb14374e89c4fc2634e07cb01851c195ad914edf76d03de9c8187a3e94bd98340f5eb37190c
7
- data.tar.gz: f6a1df4e1b7640c06682282b01bb983f6f0a81ddb97e613e9ab3314c453733ab8d5d41dbd51aab73c20c09558db84f8162b5ead8645ffc49a1eda4d7c18a3afb
6
+ metadata.gz: 9948eff2f69db1e4062c83e526d058a50b01b79e91e1e927873078228ac52885eb079e9cbf352283333ce980c043e9cfbb083091bbcec3c29dadc1fd0093fe4a
7
+ data.tar.gz: b74d4e8fac75032fd8ebccc9ae37f1dcadb870a8ef3aef7c4618d12d471b00a93d77964fd1f16f5d635deea342bf65be45bbf2dc0c9de360c0e6da59d4a67871
data/README.md CHANGED
@@ -102,14 +102,12 @@ notification.push [name_one, name_two], name_one: custom_options, name_two: cust
102
102
  Writing custom pushers is fairly simple. Just add a new subclass to `NotificationPusher`:
103
103
 
104
104
  ```ruby
105
- module NotificationPusher
106
- class CustomPusher
107
-
108
- def initialize notification, options = {}
109
- # ...
110
- end
105
+ class NotificationPusher::CustomPusher
111
106
 
107
+ def initialize notification, options = {}
108
+ # ...
112
109
  end
110
+
113
111
  end
114
112
  ```
115
113
 
@@ -24,20 +24,14 @@ module NotificationPusher
24
24
 
25
25
  def initialize_pusher
26
26
  unless self.push.nil?
27
- if self.push.kind_of(Array)
27
+ if self.push.kind_of?(Array)
28
28
  self.push.each do |class_name|
29
- pusher = NotificationPusher::Pusher.find_by_name(class_name).last
30
- if defined?(NotificationPusher.const_get(pusher.name))
31
- options = pusher.options.merge! self.push_options[class_name.to_sym]
32
- pusher.instances << NotificationPusher.const_get(pusher.name).new self, options
33
- end
29
+ pusher = NotificationPusher::Pusher.find_by_name(class_name).first
30
+ pusher.push(self, self.push_options[class_name.to_sym])
34
31
  end
35
32
  else
36
- pusher = NotificationPusher::Pusher.find_by_name(self.push).last
37
- if defined?(NotificationPusher.const_get(pusher.name))
38
- options = pusher.options.merge! self.push_options
39
- pusher.instances << NotificationPusher.const_get(pusher.name).new self, options
40
- end
33
+ pusher = NotificationPusher::Pusher.find_by_name(self.push).first
34
+ pusher.push(self, self.push_options)
41
35
  end
42
36
  end
43
37
  end
@@ -11,7 +11,16 @@ module NotificationPusher
11
11
  @options = options
12
12
  end
13
13
 
14
- def find_by_name name
14
+ def push notification, options = {}
15
+ default_options = self.options
16
+ options = default_options.merge! options
17
+ if defined?(NotificationPusher.const_get(pusher.name))
18
+ instance = NotificationPusher.const_get(self.name).new notification, options
19
+ self.instances << instance
20
+ end
21
+ end
22
+
23
+ def self.find_by_name name
15
24
  ObjectSpace.each_object(NotificationPusher::Pusher).select { |pusher| pusher.name == name }
16
25
  end
17
26
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: notification-pusher
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta9
4
+ version: 1.0.0.beta10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Hübotter
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 1.0.0.beta9
19
+ version: 1.0.0.beta10
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 1.0.0.beta9
26
+ version: 1.0.0.beta10
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement