Sha256: 90e085c3e9a0ca74cd4b55d8db55c63446af3b3623e6db6fd45937b4f4fb5d5c
Contents?: true
Size: 1.21 KB
Versions: 2
Compression:
Stored size: 1.21 KB
Contents
require 'net/ftp/list/parser' module Net class FTP module List # Parse Netware like FTP LIST entries. # # == MATCHES # # d [RWCEAFMS] dpearce 512 Jun 27 23:46 public.www # # == SYNOPSIS # # entry = Net::FTP::List::Netware.new('d [RWCEAFMS] dpearce 512 Jun 27 23:46 public.www') # entry.dir? # => true # entry.basename # => 'public.www' class Netware < Parser # Stolen straight from the ASF's commons Java FTP LIST parser library. # http://svn.apache.org/repos/asf/commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/ REGEXP = %r!^ (d|-){1}\s+ \[(.*?)\]\s+ (\S+)\s+(\d+)\s+ (\S+\s+\S+\s+((\d+:\d+)|(\d{4}))) \s+(.*) $!x # Parse a Netware like FTP LIST entries. def initialize(raw) super(raw) match = REGEXP.match(raw.strip) or raise ParserError if match[1] == 'd' @dir = true else @file = true end # TODO: Permissions, users, groups, date/time. @basename = match[9] end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
net-ftp-list-2.0.0 | lib/net/ftp/list/netware.rb |
net-ftp-list-2.0 | lib/net/ftp/list/netware.rb |