lib/httpx/plugins/upgrade.rb in httpx-0.15.4 vs lib/httpx/plugins/upgrade.rb in httpx-0.16.0
- old
+ new
@@ -16,17 +16,18 @@
def extra_options(options)
upgrade_handlers = Module.new do
extend Registry
end
+ options.merge(upgrade_handlers: upgrade_handlers)
+ end
+ end
- Class.new(options.class) do
- def_option(:upgrade_handlers, <<-OUT)
- raise Error, ":upgrade_handlers must be a registry" unless value.respond_to?(:registry)
+ module OptionsMethods
+ def option_upgrade_handlers(value)
+ raise TypeError, ":upgrade_handlers must be a registry" unless value.respond_to?(:registry)
- value
- OUT
- end.new(options).merge(upgrade_handlers: upgrade_handlers)
+ value
end
end
module InstanceMethods
def fetch_response(request, connections, options)