Class: Net::FTP::List::Parser
- Inherits:
-
Object
- Object
- Net::FTP::List::Parser
- Defined in:
- lib/net/ftp/list/parser.rb
Overview
Abstract FTP LIST parser. It really just defines and documents the interface.
Class Method Summary collapse
-
.inherited(klass) ⇒ Object
Automatically add an inheriting parser to the list of known parsers.
-
.parse(_raw) ⇒ Object
The main parse method.
-
.parsers ⇒ Object
Returns registered parsers.
-
.register(parser) ⇒ Object
Manuall register a parser.
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 |
.parsers ⇒ Object
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 |