resque-aliasing 0.3.0 → 0.4.0

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
  SHA1:
3
- metadata.gz: dcde922e1122daa2845c831e34d45e9b0f5e0978
4
- data.tar.gz: 5b848b86577779070b1fbf967c2f1603d8eda673
3
+ metadata.gz: 2614c13425403e730213c99b8d3867cae733177d
4
+ data.tar.gz: 80f7c8c825d6a15873178a8c08a2c3152a6c5e43
5
5
  SHA512:
6
- metadata.gz: ac3fdca52dae83f6dc5de372fcc288d2be8e8d59bb8f961e2fded1807b8d0fcc5e27d9544206afacf6c6a814fc73b9a47bc12cb92b54099275ca26df01ffa6e6
7
- data.tar.gz: 2b93d05b05ac6b07771ffbe364e87f876e8fe350430104052c6548d956f44ce69d1132f36b1ec03ba5cfe7f9ea22dd69c8bdd1f1835d9a09a10c7680d3041aa5
6
+ metadata.gz: b4f24127b72b8d1e00169a171f284dd5dc3a6783fa9f92730da140b552be3ecaedac37044a36131b257414f1fa30efe6e24c0bb54261956974927ff421b23a81
7
+ data.tar.gz: 5b76363689197aeb6b69a0997ed626f06bf8e303f7f1896108fed17bdad5c3445978315d36a69ac25280f217cf9070ce7ecba3e09ad78bab0be5ece75e2abd52
@@ -33,17 +33,20 @@ module Resque
33
33
  end
34
34
 
35
35
  def ensure_const parent, const_name, klass
36
+ full_const_name = const_name
37
+ full_const_name = "#{parent.name}::#{full_const_name}" unless parent == Object
38
+
36
39
  if parent.const_defined? const_name
37
40
  const = parent.const_get const_name
38
- unless const.kind_of? klass
39
- full_const_name = const_name
40
- full_const_name = "#{parent.name}::#{full_const_name}" unless parent == Object
41
- raise UnexpectedConstant, "Expected #{full_const_name} to be a #{klass.name}"
41
+ if full_const_name == const.name
42
+ unless const.kind_of? klass
43
+ raise UnexpectedConstant, "Expected #{full_const_name} to be a #{klass.name}"
44
+ end
45
+ return const
42
46
  end
43
- const
44
- else
45
- parent.const_set const_name, klass.new
46
47
  end
48
+
49
+ parent.const_set const_name, klass.new
47
50
  end
48
51
  end
49
52
  end
@@ -1,7 +1,7 @@
1
1
  module Resque
2
2
  module Plugins
3
3
  module Aliasing
4
- VERSION = "0.3.0"
4
+ VERSION = "0.4.0"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque-aliasing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Misha Conway