diff options
author | Oleksandr Avoiants <shhavel@gmail.com> | 2016-04-06 20:09:13 +0300 |
---|---|---|
committer | Oleksandr Avoiants <shhavel@gmail.com> | 2016-04-07 16:13:03 +0300 |
commit | 20214d753e15aefee645bfaf44a72b91c60c0e90 (patch) | |
tree | 486bbd75b587a450208e5d9be7427d6e54d644fb | |
parent | deec4854c0ca8efcfc6fddfd11df1dfb93bb1b82 (diff) | |
download | rack-20214d753e15aefee645bfaf44a72b91c60c0e90.tar.gz |
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 f35a7bab..90ad873f 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 |