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.
- data/lib/r_decorator/base.rb +6 -7
- data/lib/r_decorator/version.rb +1 -1
- data/spec/decorators/definition_spec.rb +6 -0
- metadata +1 -1
data/lib/r_decorator/base.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
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
|
|
data/lib/r_decorator/version.rb
CHANGED