@@ -75,7 +75,7 @@ def initialize(arguments = {}, &block)
7575 end
7676
7777 # Should just be run once at startup
78- def build_client ( options = { } )
78+ def build_client ( options = { } )
7979 client_options = options [ :transport_options ] || { }
8080 client_options [ :ssl ] = options [ :ssl ] || { }
8181
@@ -94,22 +94,22 @@ def perform_request(method, path, params={}, body=nil, headers=nil, opts={})
9494
9595 params [ :body ] = body if body
9696 params [ :headers ] = headers if headers
97- params = params . merge @request_options
97+ params = params . merge ( @request_options )
9898 case method
99- when " GET"
99+ when ' GET'
100100 resp = connection . connection . get ( url , params )
101- when " HEAD"
101+ when ' HEAD'
102102 resp = connection . connection . head ( url , params )
103- when " PUT"
103+ when ' PUT'
104104 resp = connection . connection . put ( url , params )
105- when " POST"
105+ when ' POST'
106106 resp = connection . connection . post ( url , params )
107- when " DELETE"
107+ when ' DELETE'
108108 resp = connection . connection . delete ( url , params )
109109 else
110110 raise ArgumentError . new "Method #{ method } not supported"
111111 end
112- Response . new resp . code , resp . read_body , resp . headers
112+ Response . new ( resp . code , resp . read_body , resp . headers )
113113 end
114114 end
115115
@@ -121,20 +121,19 @@ def perform_request(method, path, params={}, body=nil, headers=nil, opts={})
121121 def __build_connections
122122 apply_headers ( options )
123123
124- Connections ::Collection . new \
125- : connections => hosts . map { |host |
126- host [ :protocol ] = host [ :scheme ] || DEFAULT_PROTOCOL
127- host [ :port ] ||= DEFAULT_PORT
124+ Connections ::Collection . new (
125+ connections : hosts . map do |host |
126+ host [ :protocol ] = host [ :scheme ] || DEFAULT_PROTOCOL
127+ host [ :port ] ||= DEFAULT_PORT
128128
129129 host . delete ( :user ) # auth is not supported here.
130130 host . delete ( :password ) # use the headers
131131
132- Connections ::Connection . new \
133- :host => host ,
134- :connection => @manticore
135- } ,
136- :selector_class => options [ :selector_class ] ,
137- :selector => options [ :selector ]
132+ Connections ::Connection . new ( host : host , connection : @manticore )
133+ end ,
134+ selector_class : options [ :selector_class ] ,
135+ selector : options [ :selector ]
136+ )
138137 end
139138
140139 # Closes all connections by marking them as dead
@@ -163,15 +162,15 @@ def host_unreachable_exceptions
163162 private
164163
165164 def apply_headers ( options )
166- headers = options . dig ( :headers ) || options . dig ( :transport_options , :headers ) || { }
165+ headers = options [ :headers ] || options . dig ( :transport_options , :headers ) || { }
167166 headers [ CONTENT_TYPE_STR ] = find_value ( headers , CONTENT_TYPE_REGEX ) || DEFAULT_CONTENT_TYPE
168167 headers [ USER_AGENT_STR ] = find_value ( headers , USER_AGENT_REGEX ) || find_value ( @request_options [ :headers ] , USER_AGENT_REGEX ) || user_agent_header
169168 headers [ ACCEPT_ENCODING ] = GZIP if use_compression?
170169 @request_options [ :headers ] . merge! ( headers )
171170 end
172171
173172 def user_agent_header
174- @user_agent ||= begin
173+ @user_agent_header ||= begin
175174 meta = [ "RUBY_VERSION: #{ JRUBY_VERSION } " ]
176175 if RbConfig ::CONFIG && RbConfig ::CONFIG [ 'host_os' ]
177176 meta << "#{ RbConfig ::CONFIG [ 'host_os' ] . split ( '_' ) . first [ /[a-z]+/i ] . downcase } #{ RbConfig ::CONFIG [ 'target_cpu' ] } "
0 commit comments