Skip to content

Commit

Permalink
Call detect instead of select..first
Browse files Browse the repository at this point in the history
Detect is slightly faster than select{}.first
  • Loading branch information
RicardoTrindade authored Oct 27, 2023
1 parent 63940ac commit 5c898ed
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/webmock/http_lib_adapters/em_http_request_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def get_response_cookie(name)
raw_cookie = response_header.cookie
raw_cookie = [raw_cookie] if raw_cookie.is_a? String

cookie = raw_cookie.select { |c| c.start_with? name }.first
cookie = raw_cookie.detect { |c| c.start_with? name }
cookie and cookie.split('=', 2)[1]
end

Expand Down

0 comments on commit 5c898ed

Please # to comment.