From 39c5b122738c7c0c5b48ae901d86bbe90b6195bc Mon Sep 17 00:00:00 2001 From: Andy Brody Date: Tue, 8 Jul 2014 02:03:41 -0700 Subject: [PATCH] Fix assignments in conditions. --- bin/restclient | 9 +++++---- lib/restclient/payload.rb | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/bin/restclient b/bin/restclient index 8ac26c2..86ab597 100755 --- a/bin/restclient +++ b/bin/restclient @@ -26,10 +26,10 @@ end config = YAML.load(File.read(ENV['HOME'] + "/.restclient")) rescue {} -@url, @username, @password = if c = config[@url] - [c['url'], c['username'], c['password']] +if (c = config[@url]) + @url, @username, @password = [c['url'], c['username'], c['password']] else - [@url, * ARGV] + @url, @username, @password = [@url, * ARGV] end usage("invalid url '#{@url}") unless @url =~ /^https?/ @@ -83,7 +83,8 @@ if File.exists? ".irbrc" ENV['IRBRC'] = ".irbrc" end -if File.exists?(File.expand_path(rcfile = "~/.restclientrc")) +rcfile = File.expand_path("~/.restclientrc") +if File.exists?(rcfile) load(rcfile) end diff --git a/lib/restclient/payload.rb b/lib/restclient/payload.rb index 356a315..524089f 100644 --- a/lib/restclient/payload.rb +++ b/lib/restclient/payload.rb @@ -206,7 +206,7 @@ module RestClient s.write(" filename=\"#{v.respond_to?(:original_filename) ? v.original_filename : File.basename(v.path)}\"#{EOL}") s.write("Content-Type: #{v.respond_to?(:content_type) ? v.content_type : mime_for(v.path)}#{EOL}") s.write(EOL) - while data = v.read(8124) + while (data = v.read(8124)) s.write(data) end ensure