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

Class Method Summary collapse

Class Method Details

.inherited(klass) ⇒ Object

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



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

def inherited(klass)
  super
  register(klass)
end

.parse(_raw) ⇒ Object

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



23
24
25
# File 'lib/net/ftp/list/parser.rb', line 23

def parse(_raw, **)
  false
end

.parsersObject

Returns registered parsers.



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

def parsers
  @parsers ||= []
end

.register(parser) ⇒ Object

Manuall register a parser.



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

def register(parser)
  parsers.push(parser) unless parsers.include?(parser)
end