#old
MyController:my_action args: foo second_arg: bar
#new
MyController : My Action Args: foo, Second Arg: bar
snitch/app/helpers/mole_helper.rb:9
### Code (Old Code Commented Out) ###
#values.keys.sort { |a,b| a.to_s <=> b.to_s }.each { |k| buff <<
"<span>#{k}: #{values[k]}</span>" }
values.keys.sort { |a,b| a.to_s <=> b.to_s }.each { |k| buff <<
"<span>#{k.to_s.titleize}: #{values[k]}</span>" }
#buff.join( " " )
buff.join( ", " )
### End ###
snitch/app/views/mole/_log.rhtml:4
### Code ###
#<div class="log_feature"><%= log.mole_feature.name.gsub( /
Controller/, '')%></div>
<div class="log_feature"><%= log.mole_feature.name.gsub( /
Controller/, '').sub(/(:)(.*)$/) { "#{$1}#{$2.titleize}" } %></div>
### End ###
That second one might be more appropriate as a helper, but in the
interest of diverging as little as possible from the original, I put
it in the view.
This changes the time at the end of the log-line from:
16:57:30
to:
04:57:30 PM
or from:
04/15 16:57:30
to:
Apr 15 : 04:57:30 PM
Which format is better is certainly arguable, but to my american eyes
the time is more readily understood in the 12hr format. As for the
date, I just prefer the word format, and at only 1 addition character
it's more than worth it to me.
### Code ###
# Formats console timestamp
def timestamp( log )
if log.created_at.yday == @now.yday
#log.created_at.strftime( "%H:%M:%S" )
log.created_at.strftime( "%I:%M:%S %p" )
else
#log.created_at.strftime( "%m/%d %H:%M:%S" )
log.created_at.strftime( "%b %d : %I:%M:%S %p" )
end
end
### End ###