r_decorator 0.0.3 → 0.0.4

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.
@@ -59,16 +59,15 @@ module RDecorator
59
59
  def self.target_to_class(target, ignore_missing = false)
60
60
  case target
61
61
  when String, Symbol
62
- if ignore_missing
63
- klass = target.to_s.camelize.safe_constantize
64
- return nil if klass == nil
65
- else
66
- klass = target.to_s.camelize.constantize
67
- end
62
+ klass = target.to_s.camelize.safe_constantize
68
63
  else
69
64
  klass = target
70
65
  end
71
- raise "Invalid target for decoration(#{self}): #{klass}" unless klass.is_a?(Class)
66
+
67
+ unless klass.is_a?(Class)
68
+ raise "Invalid target for decoration(#{self}): #{klass}" unless ignore_missing
69
+ klass = nil
70
+ end
72
71
  klass
73
72
  end
74
73
 
@@ -1,3 +1,3 @@
1
1
  module RDecorator
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -25,6 +25,12 @@ feature "Definition" do
25
25
  origin.say * 3
26
26
  end
27
27
  end
28
+
29
+ module NoClass
30
+ end
31
+
32
+ class NoClassDecorator < RDecorator::Base
33
+ end
28
34
 
29
35
  scenario "Auto decoration by class-name" do
30
36
  foo = Foo.new
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: r_decorator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: