lib/httpx/chainable.rb in httpx-0.7.0 vs lib/httpx/chainable.rb in httpx-0.8.0
- old
+ new
@@ -1,12 +1,14 @@
# frozen_string_literal: true
module HTTPX
module Chainable
%i[head get post put delete trace options connect patch].each do |meth|
- define_method meth do |*uri, **options|
- request(meth, uri, **options)
- end
+ class_eval(<<-MOD, __FILE__, __LINE__ + 1)
+ def #{meth}(*uri, **options)
+ request(:#{meth}, uri, **options)
+ end
+ MOD
end
def request(verb, uri, **options)
branch(default_options).request(verb, uri, **options)
end