diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2016-04-11 21:08:18 -0300 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2016-04-11 21:08:18 -0300 |
commit | 9f7703ebeb54d4015f898aad7d5d80c8cda982a2 (patch) | |
tree | 7a7d05c394604c452614d6e38ef7fd7295714507 | |
parent | 2da7bd3688f3a6fd9d5bf746b721b990dd962d4f (diff) | |
parent | 20214d753e15aefee645bfaf44a72b91c60c0e90 (diff) | |
download | rack-9f7703ebeb54d4015f898aad7d5d80c8cda982a2.tar.gz |
Merge pull request #1045 from shhavel/feature/use_string_interpolation_instead_plus
Use String interpolation or << instead plus which are faster
-rw-r--r-- | lib/rack/auth/digest/params.rb | 3 | ||||
-rw-r--r-- | lib/rack/common_logger.rb | 2 | ||||
-rw-r--r-- | lib/rack/directory.rb | 2 | ||||
-rw-r--r-- | lib/rack/multipart/generator.rb | 2 | ||||
-rw-r--r-- | lib/rack/multipart/parser.rb | 2 |
5 files changed, 5 insertions, 6 deletions
diff --git a/lib/rack/auth/digest/params.rb b/lib/rack/auth/digest/params.rb index 52108d82..2b226e62 100644 --- a/lib/rack/auth/digest/params.rb +++ b/lib/rack/auth/digest/params.rb @@ -38,7 +38,7 @@ module Rack def to_s map do |k, v| - "#{k}=" + (UNQUOTED.include?(k) ? v.to_s : quote(v)) + "#{k}=" << (UNQUOTED.include?(k) ? v.to_s : quote(v)) end.join(', ') end @@ -50,4 +50,3 @@ module Rack end end end - diff --git a/lib/rack/common_logger.rb b/lib/rack/common_logger.rb index 1ec8266d..ae410430 100644 --- a/lib/rack/common_logger.rb +++ b/lib/rack/common_logger.rb @@ -48,7 +48,7 @@ module Rack now.strftime("%d/%b/%Y:%H:%M:%S %z"), env[REQUEST_METHOD], env[PATH_INFO], - env[QUERY_STRING].empty? ? "" : "?"+env[QUERY_STRING], + env[QUERY_STRING].empty? ? "" : "?#{env[QUERY_STRING]}", env[HTTP_VERSION], status.to_s[0..3], length, diff --git a/lib/rack/directory.rb b/lib/rack/directory.rb index 554f9c33..5baee3c8 100644 --- a/lib/rack/directory.rb +++ b/lib/rack/directory.rb @@ -155,7 +155,7 @@ table { width:100%%; } return format % (int.to_f / size) if int >= size end - int.to_s + 'B' + "#{int}B" end end end diff --git a/lib/rack/multipart/generator.rb b/lib/rack/multipart/generator.rb index 6367135f..f0b70a8d 100644 --- a/lib/rack/multipart/generator.rb +++ b/lib/rack/multipart/generator.rb @@ -22,7 +22,7 @@ module Rack else content_for_other(file, name) end - end.join + "--#{MULTIPART_BOUNDARY}--\r" + end.join << "--#{MULTIPART_BOUNDARY}--\r" end private diff --git a/lib/rack/multipart/parser.rb b/lib/rack/multipart/parser.rb index 567c868d..74a7ee67 100644 --- a/lib/rack/multipart/parser.rb +++ b/lib/rack/multipart/parser.rb @@ -26,7 +26,7 @@ module Rack str = if left < size @io.read left else - @io.read size + @io.read size end if str |