Class: Net::FTP::List::Netware
- Inherits:
-
Parser
- Object
- Parser
- Net::FTP::List::Netware
- Defined in:
- lib/net/ftp/list/netware.rb
Overview
Parse Netware like FTP LIST entries.
MATCHES
d [RWCEAFMS] dpearce 512 Jun 27 23:46 public.www
Constant Summary
- REGEXP =
Stolen straight from the ASF's commons Java FTP LIST parser library. svn.apache.org/repos/asf/commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/
%r!^ (d|-){1}\s+ \[(.*?)\]\s+ (\S+)\s+(\d+)\s+ (\S+\s+\S+\s+((\d+:\d+)|(\d{4}))) \s+(.*) $!x
Class Method Summary (collapse)
-
+ (Object) parse(raw)
Parse a Netware like FTP LIST entries.
Class Method Details
+ (Object) parse(raw)
Parse a Netware like FTP LIST entries.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/net/ftp/list/netware.rb', line 21 def self.parse(raw) match = REGEXP.match(raw.strip) or return false is_dir = match[1] == 'd' emit_entry( raw, :mtime => Time.parse(match[5]), :filesize => match[4].to_i, :dir => is_dir, :file => !is_dir, :basename => match[9] ) end |