promiscuous 0.8.5 → 0.8.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,8 +3,8 @@ module Promiscuous::Common::ClassHelpers
3
3
 
4
4
  module ClassMethods
5
5
  def guess_class_name(separator)
6
+ return nil if name.nil?
6
7
  class_name = name.split("::").reverse.take_while { |name| name != separator }.reverse.join('::')
7
- class_name = "::#{class_name}"
8
8
  class_name = $1 if class_name =~ /^(.+)#{separator.singularize}$/
9
9
  class_name
10
10
  end
@@ -24,11 +24,8 @@ module Promiscuous::Publisher::Class
24
24
  end
25
25
 
26
26
  def klass
27
- if super
28
- "::#{super}".constantize
29
- elsif name
30
- guess_class_name('Publishers').constantize
31
- end
27
+ return nil if name.nil?
28
+ "::#{super ? super : guess_class_name('Publishers')}".constantize
32
29
  end
33
30
  end
34
31
  end
@@ -20,11 +20,7 @@ class Promiscuous::Publisher::Mock
20
20
  end
21
21
 
22
22
  def self.class_name
23
- if self.klass
24
- self.klass
25
- elsif name
26
- guess_class_name('Publishers')
27
- end
23
+ self.klass ? self.klass : guess_class_name('Publishers')
28
24
  end
29
25
 
30
26
  def initialize
@@ -10,11 +10,8 @@ module Promiscuous::Subscriber::Class
10
10
 
11
11
  module ClassMethods
12
12
  def klass
13
- if super
14
- "::#{super}".constantize
15
- elsif name
16
- guess_class_name('Subscribers').constantize
17
- end
13
+ return nil if name.nil?
14
+ "::#{super ? super : guess_class_name('Subscribers')}".constantize
18
15
  end
19
16
  end
20
17
  end
@@ -10,11 +10,7 @@ module Promiscuous::Subscriber::Polymorphic
10
10
 
11
11
  module ClassMethods
12
12
  def from_type
13
- return super if super
14
-
15
- if name
16
- guess_class_name('Subscribers')
17
- end
13
+ super ? super : guess_class_name('Subscribers')
18
14
  end
19
15
 
20
16
  def from_type=(value)
@@ -1,3 +1,3 @@
1
1
  module Promiscuous
2
- VERSION = '0.8.5'
2
+ VERSION = '0.8.6'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: promiscuous
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.5
4
+ version: 0.8.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-09-11 00:00:00.000000000 Z
13
+ date: 2012-09-12 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport