Class: Parser
- Inherits:
-
Object
- Object
- Parser
- Defined in:
- lib/gl_tail/parser.rb
Direct Known Subclasses
ApacheParser, IISParser, MysqlParser, NginxParser, PixParser, PostfixParser, PostgreSQLParser, PureftpdParser, QmailParser, RailsParser, TSharkParser
Instance Attribute Summary collapse
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Class Method Summary collapse
Instance Method Summary collapse
-
#add_activity(opts = {}) ⇒ Object
dsl-ish helper methods so the parsers don’t call server.add_* anymore.
- #add_event(opts = {}) ⇒ Object
-
#initialize(source) ⇒ Parser
constructor
A new instance of Parser.
- #parse(line) ⇒ Object
-
#server ⇒ Object
DEPRECATED?.
Constructor Details
#initialize(source) ⇒ Parser
Returns a new instance of Parser.
12 13 14 |
# File 'lib/gl_tail/parser.rb', line 12 def initialize( source ) @source = source end |
Instance Attribute Details
#source ⇒ Object (readonly)
Returns the value of attribute source.
10 11 12 |
# File 'lib/gl_tail/parser.rb', line 10 def source @source end |
Class Method Details
.inherited(klass) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/gl_tail/parser.rb', line 21 def self::inherited( klass ) parser_name = klass.to_s.sub( /Parser$/, '' ).downcase.intern @registry ||= {} @registry[ parser_name ] = klass end |
.registry ⇒ Object
28 29 30 |
# File 'lib/gl_tail/parser.rb', line 28 def self::registry return @registry end |
Instance Method Details
#add_activity(opts = {}) ⇒ Object
dsl-ish helper methods so the parsers don’t call server.add_* anymore. That seems magical now that server isn’t be explicitly passed anymore.
39 40 41 |
# File 'lib/gl_tail/parser.rb', line 39 def add_activity( opts = {} ) @source.add_activity( opts ) end |
#add_event(opts = {}) ⇒ Object
43 44 45 |
# File 'lib/gl_tail/parser.rb', line 43 def add_event( opts = {} ) @source.add_event( opts ) end |
#parse(line) ⇒ Object
32 33 34 35 |
# File 'lib/gl_tail/parser.rb', line 32 def parse( line ) raise NotImplementedError, "Concrete parsers must implement parse()" end |
#server ⇒ Object
DEPRECATED?
17 18 19 |
# File 'lib/gl_tail/parser.rb', line 17 def server @source end |