mirror of
https://github.com/lostisland/faraday.git
synced 2025-08-30 00:03:09 -04:00
fix Builder#initialize
with block
This commit is contained in:
parent
198546900c
commit
692199bd08
@ -52,7 +52,7 @@ module Faraday
|
||||
def initialize(handlers = [])
|
||||
@handlers = handlers
|
||||
@inner_app = self.class.inner_app
|
||||
build(Proc.new) if block_given?
|
||||
build(&Proc.new) if block_given?
|
||||
end
|
||||
|
||||
def build(options = {})
|
||||
|
@ -33,9 +33,7 @@ module Faraday
|
||||
merge_headers @headers, options[:headers] if options[:headers]
|
||||
|
||||
if block_given?
|
||||
block = Proc.new
|
||||
@builder = Builder.new
|
||||
@builder.build { block.call(self) }
|
||||
@builder = Builder.create { |b| yield b }
|
||||
else
|
||||
@builder = options[:builder] || Builder.new
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user