lib/httpx/registry.rb in httpx-0.3.1 vs lib/httpx/registry.rb in httpx-0.4.0
- old
+ new
@@ -56,11 +56,13 @@
# will assume it referes to an autoloaded module, and will load-and-return it).
#
def registry(tag = nil)
@registry ||= {}
return @registry if tag.nil?
+
handler = @registry.fetch(tag)
raise(Error, "#{tag} is not registered in #{self}") unless handler
+
case handler
when Symbol, String
const_get(handler)
else
handler