Skip to content

Use frozen string literals #144

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/net/http.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
#
# = net/http.rb
#
Expand Down Expand Up @@ -1615,8 +1615,8 @@ def connect
write_timeout: @write_timeout,
continue_timeout: @continue_timeout,
debug_output: @debug_output)
buf = "CONNECT #{conn_address}:#{@port} HTTP/#{HTTPVersion}\r\n"
buf << "Host: #{@address}:#{@port}\r\n"
buf = +"CONNECT #{conn_address}:#{@port} HTTP/#{HTTPVersion}\r\n" \
"Host: #{@address}:#{@port}\r\n"
if proxy_user
credential = ["#{proxy_user}:#{proxy_pass}"].pack('m0')
buf << "Proxy-Authorization: Basic #{credential}\r\n"
Expand Down
2 changes: 1 addition & 1 deletion lib/net/http/backward.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
# for backward compatibility

# :enddoc:
Expand Down
2 changes: 1 addition & 1 deletion lib/net/http/exceptions.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
module Net
# Net::HTTP exception class.
# You cannot use Net::HTTPExceptions directly; instead, you must use
Expand Down
6 changes: 3 additions & 3 deletions lib/net/http/generic_request.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
#
# \HTTPGenericRequest is the parent of the Net::HTTPRequest class.
#
Expand Down Expand Up @@ -316,7 +316,7 @@ def encode_multipart_form_data(out, params, opt)
boundary ||= SecureRandom.urlsafe_base64(40)
chunked_p = chunked?

buf = ''
buf = +''
params.each do |key, value, h={}|
key = quote_string(key, charset)
filename =
Expand Down Expand Up @@ -401,7 +401,7 @@ def write_header(sock, ver, path)
if /[\r\n]/ =~ reqline
raise ArgumentError, "A Request-Line must not contain CR or LF"
end
buf = ""
buf = +''
buf << reqline << "\r\n"
each_capitalized do |k,v|
buf << "#{k}: #{v}\r\n"
Expand Down
2 changes: 1 addition & 1 deletion lib/net/http/header.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
#
# The \HTTPHeader module provides access to \HTTP headers.
#
Expand Down
2 changes: 1 addition & 1 deletion lib/net/http/proxy_delta.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
module Net::HTTP::ProxyDelta #:nodoc: internal use only
private

Expand Down
2 changes: 1 addition & 1 deletion lib/net/http/request.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true

# This class is the base class for \Net::HTTP request classes.
# The class should not be used directly;
Expand Down
2 changes: 1 addition & 1 deletion lib/net/http/requests.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true

# HTTP/1.1 methods --- RFC2616

Expand Down
6 changes: 3 additions & 3 deletions lib/net/http/response.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true

# This class is the base class for \Net::HTTP response classes.
#
Expand Down Expand Up @@ -273,7 +273,7 @@ def code_type #:nodoc:

def error! #:nodoc:
message = @code
message += ' ' + @message.dump if @message
message = "#{message} #{@message.dump}" if @message
raise error_type().new(message, self)
end

Expand Down Expand Up @@ -648,7 +648,7 @@ def procdest(dest, block)
if block
Net::ReadAdapter.new(block)
else
dest || ''
dest || +''
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/net/https.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
=begin
= net/https -- SSL/TLS enhancement for Net::HTTP.
Expand Down