lib/transmutation/serialization/lookup.rb in transmutation-0.3.0 vs lib/transmutation/serialization/lookup.rb in transmutation-0.3.1

- old
+ new

@@ -50,16 +50,18 @@ def potential_namespaces @potential_namespaces ||= begin namespace_parts = serializer_namespace.split("::") - namespace_parts.filter_map.with_index do |part, index| + namespaces = namespace_parts.filter_map.with_index do |part, index| namespace = [*namespace_parts[...index], part].join("::") next if namespace.empty? Object.const_get(namespace) if Object.const_defined?(namespace) - end.reverse + end + + [*namespaces.reverse, Object] end end def serializer_namespace return caller_namespace if @namespace.nil?