Class: Wlog::LogEntry

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
TextFilters
Defined in:
lib/wlog/domain/log_entry.rb

Overview

Active Record Domain object for a log entry

Instance Method Summary collapse

Methods included from TextFilters

#highlight_hyperlink_s

Instance Method Details

#to_sObject

Print things nicely formmated no more than 80 cars (well, unless you stick the time in the end which is not counted for).



17
18
19
20
21
22
23
24
25
# File 'lib/wlog/domain/log_entry.rb', line 17

def to_s
  str    = "[#{id}] "
  tmp    = "#{description} [#{created_at.strftime("%H:%M:%S")}]"
  desc   = Helpers.break_string(tmp,80)
  indent = " " * (id.to_s.split('').count + 5)
  desc.gsub!(/#{$/}/, "#{$/}#{indent}")
  str.concat(desc)
  highlight_hyperlink_s(str)
end