lib/swagger/serializer/store.rb in swagger-serializer-0.8.3 vs lib/swagger/serializer/store.rb in swagger-serializer-0.9.0
- old
+ new
@@ -25,13 +25,14 @@
@injectors = injectors
@cache = cache
end
def [](name)
+ serializer_name = name.to_s.gsub(/-/, '::').sub(/(?:Serializer)?$/, "Serializer")
if @cache
- @injectors[name] ||= "#{name}Serializer".safe_constantize
+ @injectors[name] ||= serializer_name.safe_constantize
else
- "#{name}Serializer".safe_constantize
+ serializer_name.safe_constantize
end
end
end
end
end