Sha256: 35bde9e3bae97fbefc6161f0afd7d95020d3cbcc522d1109969d824165ab76e2
Contents?: true
Size: 568 Bytes
Versions: 1
Compression:
Stored size: 568 Bytes
Contents
module LogParser class LineItem < BasicObject attr_reader :timestamp, :type, :prefix, :message def initialize(timestamp, type, prefix, message) @timestamp, @type, @prefix, @message = timestamp, type, prefix, message end def to_s s = "[#{timestamp}] " s << "#{type}: " if type s << "[#{prefix}] " if prefix s << "#{message}" s end alias inspect to_s def full_message prefix ? "[#{prefix}] #{message}" : message end def <=>(other) timestamp <=> other.timestamp end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
log_parser-2.0.3 | lib/log_parser/line_item.rb |