notification-pusher 1.0.0.beta8 → 1.0.0.beta9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a9ff67c2e1435a9b631aab3aec4ccdf4f940ce0a2d351a8336f161122d5b43dd
4
- data.tar.gz: 8f4b3f51430152f3c1aff871abe8a716be6dbb9c6277cece73f8622ca4bc596a
3
+ metadata.gz: c7bd278a400f98567d17b9e39887e5e8960ddbfd99b9c2ad9edb6a462cf12f7c
4
+ data.tar.gz: bcd25f7e997fae9a09a75cec3b8994bacd4ba15c7500b786db314efff13b3f81
5
5
  SHA512:
6
- metadata.gz: dab9452ca10ad43a2b7b79f803718c4b239389e44c2b608e35f3f18a6c03ceeab222b4ad4099f0b4a23f3aac0a5cb10a585f73e2b4a0a6fbc18fb7576ed57e66
7
- data.tar.gz: 8c388e9c1b8a79e42f4d115dc8f16de6932504afbf6d5bf9c20c53c1a87f292851c0ac57b4eddb49ce57dbadbcc93c291703c238236e0186555f3da1da1061ec
6
+ metadata.gz: 9188a46b341e911a926f67256f9ce958bc4fa20bd2dca0fd6d1dffb14374e89c4fc2634e07cb01851c195ad914edf76d03de9c8187a3e94bd98340f5eb37190c
7
+ data.tar.gz: f6a1df4e1b7640c06682282b01bb983f6f0a81ddb97e613e9ab3314c453733ab8d5d41dbd51aab73c20c09558db84f8162b5ead8645ffc49a1eda4d7c18a3afb
@@ -12,8 +12,7 @@ module NotificationPusher
12
12
  class Configuration
13
13
 
14
14
  def define_pusher name, options = {}
15
- options[:name] = name
16
- ::NotificationPusher::Pusher.new options
15
+ ::NotificationPusher::Pusher.new name, options
17
16
  end
18
17
 
19
18
  end
@@ -1,37 +1,47 @@
1
1
  module NotificationPusher
2
2
  module NotificationLibrary
3
3
 
4
- attr_accessor :push
5
- attr_accessor :push_options
4
+ extend ActiveSupport::Concern
6
5
 
7
- after_create_commit :initialize_pusher
6
+ included do
7
+ attr_accessor :push
8
+ attr_accessor :push_options
8
9
 
9
- def push name, options = {}
10
- self.push = class_name
11
- self.push_options = options
12
- self.initialize_pusher
10
+ after_create_commit :initialize_pusher
11
+
12
+ include NotificationPusher::NotificationLibrary::InstanceMethods
13
13
  end
14
14
 
15
- private
15
+ module InstanceMethods
16
+
17
+ def push name, options = {}
18
+ self.push = class_name
19
+ self.push_options = options
20
+ self.initialize_pusher
21
+ end
22
+
23
+ private
16
24
 
17
- def initialize_pusher
18
- unless self.push.nil?
19
- if self.push.kind_of(Array)
20
- self.push.each do |class_name|
21
- pusher = NotificationPusher::Pusher.find_by_name(class_name).last
25
+ def initialize_pusher
26
+ unless self.push.nil?
27
+ if self.push.kind_of(Array)
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
34
+ end
35
+ else
36
+ pusher = NotificationPusher::Pusher.find_by_name(self.push).last
22
37
  if defined?(NotificationPusher.const_get(pusher.name))
23
- options = pusher.options.merge! self.push_options[class_name.to_sym]
24
- pusher.instances << NotificationPusher.const_get(pusher.name).new options
38
+ options = pusher.options.merge! self.push_options
39
+ pusher.instances << NotificationPusher.const_get(pusher.name).new self, options
25
40
  end
26
41
  end
27
- else
28
- pusher = NotificationPusher::Pusher.find_by_name(self.push).last
29
- if defined?(NotificationPusher.const_get(pusher.name))
30
- options = pusher.options.merge! self.push_options
31
- pusher.instances << NotificationPusher.const_get(pusher.name).new self, options
32
- end
33
42
  end
34
43
  end
44
+
35
45
  end
36
46
 
37
47
  end
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.beta8
4
+ version: 1.0.0.beta9
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.beta8
19
+ version: 1.0.0.beta9
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.beta8
26
+ version: 1.0.0.beta9
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement