lib/mystique.rb in mystique-0.3.0 vs lib/mystique.rb in mystique-0.4.0
- old
+ new
@@ -53,11 +53,11 @@
def self.format_multiple(*matchers, &block)
matchers.each do |matcher|
format(matcher, &block)
end
end
-
+
def __formats__
self.class.__formats__
end
def self.__formats__
@@ -88,10 +88,14 @@
module_function
def present(object, with: nil, context: nil, &block)
presenter_class = case with
when nil
- "#{object.class}Presenter".constantize
+ begin
+ "#{object.class}Presenter".constantize
+ rescue NameError => e
+ return object
+ end
when Symbol, String
"#{with}Presenter".constantize
else
with
end