Class: Net::FTP::List::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/net/ftp/list/parser.rb

Overview

Abstract FTP LIST parser. It really just defines and documents the interface.

Direct Known Subclasses

Microsoft, Netware, Rumpus, Unix, Unknown

Constant Summary

@@parsers =
[]

Class Method Summary (collapse)

Class Method Details

+ (Object) inherited(klass)

Automatically add an inheriting parser to the list of known parsers.



13
14
15
# File 'lib/net/ftp/list/parser.rb', line 13

def self.inherited(klass) #:nodoc:
  @@parsers.push(klass)
end

+ (Object) parse(raw)

The main parse method. Return false from it if parsing fails (this is cheaper than raising an exception)



18
19
20
# File 'lib/net/ftp/list/parser.rb', line 18

def self.parse(raw)
  return false
end

+ (Object) with_each_parser(&blk)

Run a passed block with each parser in succession, from the most specific to the least specific. Will return the result of the block.



8
9
10
# File 'lib/net/ftp/list/parser.rb', line 8

def self.with_each_parser(&blk) #:yields: parser
  @@parsers.each(&blk)
end