lib/net/ftp/list/unix.rb in net-ftp-list-2.0.0 vs lib/net/ftp/list/unix.rb in net-ftp-list-2.1.1
- old
+ new
@@ -1,15 +1,16 @@
+require 'time'
require 'net/ftp/list/parser'
module Net
class FTP
module List
# Parse Unix like FTP LIST entries.
#
# == MATCHES
- #
+ #
# drwxr-xr-x 4 steve group 4096 Dec 10 20:23 etc
# -rw-r--r-- 1 root other 531 Jan 29 03:26 README.txt
#
# == SYNOPSIS
#
@@ -44,9 +45,11 @@
when /[bc]/ then # Do nothing with devices for now.
else ParserError 'Unknown LIST entry type.'
end
# TODO: Permissions, users, groups, date/time.
+ @filesize = match[18].to_i
+ @mtime = Time.parse("#{match[19]} #{match[20]}")
@basename = match[21].strip
# filenames with spaces will end up in the last match
@basename += match[22] unless match[22].nil?