Class: Net::FTP::BufferedSocket

Inherits:
BufferedIO show all
Defined in:
lib/net/ftp.rb

Instance Attribute Summary

Attributes inherited from BufferedIO

#continue_timeout, #debug_output, #io, #read_timeout

Instance Method Summary collapse

Methods inherited from BufferedIO

#close, #closed?, #eof?, #initialize, #inspect, #read_all, #readuntil, #write, #writeline

Constructor Details

This class inherits a constructor from Net::BufferedIO

Instance Method Details

#getsObject



1101
1102
1103
1104
1105
# File 'lib/net/ftp.rb', line 1101

def gets
  return readuntil("\n")
rescue EOFError
  return nil
end

#read(len = nil) ⇒ Object



1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
# File 'lib/net/ftp.rb', line 1087

def read(len = nil)
  if len
    s = super(len, "", true)
    return s.empty? ? nil : s
  else
    result = ""
    while s = super(DEFAULT_BLOCKSIZE, "", true)
      break if s.empty?
      result << s
    end
    return result
  end
end

#readlineObject



1107
1108
1109
# File 'lib/net/ftp.rb', line 1107

def readline
  return readuntil("\n")
end