module LogParser::Pattern
Represents a certain pattern log message. The model we use is that
* a pattern tells you if a message starts in a given line, and * reads lines from there on until it ends.
The result will be a {Message}.
Public Instance Methods
begins_at?(_line)
click to toggle source
Checks if this message pattern matches the given line.
@abstract @param [String] _line
The log line currently under investigation.
@return [true,false]
`true` if (and only if) this pattern can parse a single message from the given line onwards.
# File lib/log_parser/pattern.rb, line 16 def begins_at?(_line) raise NotImplementedError end
read(_lines)
click to toggle source
Reads a message from the given lines.
@abstract @param [LogParser::Buffer] _lines
A source of log lines to read from.
@return [Array<(Message
, Int)>]
An array of the message that was read, and the number of lines that it spans.
@raise
If no message end could be found among the given lines.
# File lib/log_parser/pattern.rb, line 29 def read(_lines) raise NotImplementedError end