diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2017-03-27 17:47:34 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-27 17:47:34 -0400 |
commit | 37f6d8a388907c3609e5d67687621a7796888f93 (patch) | |
tree | 3b57b37613b7de01d0e81c8db07d0cb42796e999 | |
parent | 647438af0019c9cf5e0e1418997b551f7b580b35 (diff) | |
parent | 78d19bccec58fe8d29fe237c052ccef45aecd1cb (diff) | |
download | rack-37f6d8a388907c3609e5d67687621a7796888f93.tar.gz |
Merge pull request #1151 from cremno/simplify-some-string-creations
Simplify some string creations
-rw-r--r-- | lib/rack/chunked.rb | 2 | ||||
-rw-r--r-- | lib/rack/mock.rb | 2 | ||||
-rw-r--r-- | lib/rack/multipart/parser.rb | 4 |
3 files changed, 4 insertions, 4 deletions
diff --git a/lib/rack/chunked.rb b/lib/rack/chunked.rb index 4b8f270e..3076931c 100644 --- a/lib/rack/chunked.rb +++ b/lib/rack/chunked.rb @@ -24,7 +24,7 @@ module Rack size = chunk.bytesize next if size == 0 - chunk = chunk.dup.force_encoding(Encoding::BINARY) + chunk = chunk.b yield [size.to_s(16), term, chunk, term].join end yield TAIL diff --git a/lib/rack/mock.rb b/lib/rack/mock.rb index afc855e2..f3321772 100644 --- a/lib/rack/mock.rb +++ b/lib/rack/mock.rb @@ -128,7 +128,7 @@ module Rack end end - empty_str = String.new.force_encoding(Encoding::ASCII_8BIT) + empty_str = String.new opts[:input] ||= empty_str if String === opts[:input] rack_input = StringIO.new(opts[:input]) diff --git a/lib/rack/multipart/parser.rb b/lib/rack/multipart/parser.rb index d8cb3670..e2e821ac 100644 --- a/lib/rack/multipart/parser.rb +++ b/lib/rack/multipart/parser.rb @@ -135,7 +135,7 @@ module Rack klass = TempfilePart @open_files += 1 else - body = ''.force_encoding(Encoding::ASCII_8BIT) + body = String.new klass = BufferPart end @@ -165,7 +165,7 @@ module Rack attr_reader :state def initialize(boundary, tempfile, bufsize, query_parser) - @buf = "".force_encoding(Encoding::ASCII_8BIT) + @buf = String.new @query_parser = query_parser @params = query_parser.make_params |