@@ -72,12 +72,12 @@ def initialize(options = {}) # rubocop:disable Style/OptionHash
7272 opts_w_defaults . each { |( k , v ) | self [ k ] = v }
7373 end
7474
75- def_option :headers do |headers |
76- self . headers . merge ( headers )
75+ def_option :headers do |new_headers |
76+ headers . merge ( new_headers )
7777 end
7878
79- def_option :cookies do |cookies |
80- cookies . each_with_object self . cookies . dup do |( k , v ) , jar |
79+ def_option :cookies do |new_cookies |
80+ new_cookies . each_with_object cookies . dup do |( k , v ) , jar |
8181 cookie = k . is_a? ( Cookie ) ? k : Cookie . new ( k . to_s , v . to_s )
8282 jar [ cookie . name ] = cookie . cookie_value
8383 end
@@ -87,23 +87,23 @@ def initialize(options = {}) # rubocop:disable Style/OptionHash
8787 self . encoding = Encoding . find ( encoding )
8888 end
8989
90- def_option :features , :reader_only => true do |features |
90+ def_option :features , :reader_only => true do |new_features |
9191 # Normalize features from:
9292 #
9393 # [{feature_one: {opt: 'val'}}, :feature_two]
9494 #
9595 # into:
9696 #
9797 # {feature_one: {opt: 'val'}, feature_two: {}}
98- features = features . each_with_object ( { } ) do |feature , h |
98+ normalized_features = new_features . each_with_object ( { } ) do |feature , h |
9999 if feature . is_a? ( Hash )
100100 h . merge! ( feature )
101101 else
102102 h [ feature ] = { }
103103 end
104104 end
105105
106- self . features . merge ( features )
106+ features . merge ( normalized_features )
107107 end
108108
109109 def features = ( features )
@@ -195,4 +195,3 @@ def argument_error!(message)
195195 end
196196 end
197197end
198-
0 commit comments