Skip to content

Commit

Permalink
This fixes warnings on Ruby 2.7 (#1009)
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove authored and iMacTia committed Aug 15, 2019
1 parent e8792e4 commit f4ae96e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/faraday/adapter/em_http.rb
Expand Up @@ -229,11 +229,11 @@ def running?
@running
end

def add
def add(&block)
if running?
perform_request { yield }
else
@registered_procs << Proc.new
@registered_procs << block
end
@num_registered += 1
end
Expand Down
2 changes: 1 addition & 1 deletion lib/faraday/options.rb
Expand Up @@ -79,7 +79,7 @@ def fetch(key, *args)
if !args.empty?
send(key_setter, args.first)
elsif block_given?
send(key_setter, Proc.new.call(key))
send(key_setter, yield(key))
else
raise self.class.fetch_error_class, "key not found: #{key.inspect}"
end
Expand Down
4 changes: 2 additions & 2 deletions lib/faraday/response.rb
Expand Up @@ -55,9 +55,9 @@ def finished?
!!env
end

def on_complete
def on_complete(&block)
if !finished?
@on_complete_callbacks << Proc.new
@on_complete_callbacks << block
else
yield(env)
end
Expand Down

0 comments on commit f4ae96e

Please sign in to comment.