title: Net::ftp getbinaryfile() saving to file vs saving to variable
body: <p>Using the following <code>ftp_download</code> method works, but if I change </p>
  
  <pre><code>ftp.getbinaryfile(file,localdir,1024)   #=&gt; Saves the file to localdir
  </code></pre>
  
  <p>to</p>
  
  <pre><code>ftp.getbinaryfile(file)    #=&gt; returns nil
  </code></pre>
  
  <p>I get <code>nil</code> returned.  According to</p>
  
  <p><a href="http://www.ruby-doc.org/stdlib-2.0/libdoc/net/ftp/rdoc/Net/FTP.html#method-i-getbinaryfile" rel="noreferrer">http://www.ruby-doc.org/stdlib-2.0/libdoc/net/ftp/rdoc/Net/FTP.html#method-i-getbinaryfile</a></p>
  
  <p>inilf I set <code>localfile</code> to <code>nil</code> as above, the data should be retrieved and returned by the method.  What am I doing wrong?</p>
  
  <pre><code>def ftp_download(domain,remotedir,filename_regex,user=nil,pwd=nil)
    ftp = Net::FTP::new(domain)
    if user &amp;&amp; pwd
      ftp.login(user, pwd)
    end
    ftp.chdir(remotedir)
    fileList = ftp.nlst(filename_regex)
  
    fileList.each do |file|
      localdir=File.join(remotedir,file)
      localdir=localdir[1..-1] if localdir[0]="/"
      FileUtils.mkdir_p(File.dirname(localdir))
      ftp.getbinaryfile(file,localdir,1024)
    end
    ftp.close
  end
  </code></pre>