class Mhc::LogEntry
Attributes
mtime[R]
path[R]
rec_id[R]
status[R]
subject[R]
Public Class Methods
new(status, mtime = nil, rec_id = nil, path = nil, subject = nil)
click to toggle source
# File lib/mhc/logger.rb, line 60 def initialize(status, mtime = nil, rec_id = nil, path = nil, subject = nil) if mtime.nil? init_from_string(status) else @status, @mtime, @rec_id, @path, @subject = status, mtime, rec_id, path, subject end end
Public Instance Methods
to_s()
click to toggle source
# File lib/mhc/logger.rb, line 69 def to_s return [ @status, @mtime.strftime("%Y-%m-%d %H:%M:%S"), @rec_id, @path, @subject ].join(' ') end
Private Instance Methods
init_from_string(line)
click to toggle source
# File lib/mhc/logger.rb, line 82 def init_from_string(line) str = line.chomp status, yymmdd, hhmmss, rec_id, path, subject = str.split yy, mm, dd = yymmdd.split('-') h, m, s = hhmmss.split(':') mtime = Time.local(yy.to_i, mm.to_i, dd.to_i, h .to_i, m .to_i, s .to_i) @status, @mtime, @rec_id, @path, @subject = status, mtime, rec_id, path, subject end