class Parser::Reporter
Constants
- EVENT_TYPE_COLORS
Public Class Methods
new(event)
click to toggle source
# File lib/parser/reporter.rb, line 15 def initialize(event) @event = event end
report(event)
click to toggle source
# File lib/parser/reporter.rb, line 11 def self.report(event) new(event).report end
Public Instance Methods
report()
click to toggle source
# File lib/parser/reporter.rb, line 19 def report "#{datetime} #{user_name}: #{description}" end
Private Instance Methods
datetime()
click to toggle source
# File lib/parser/reporter.rb, line 25 def datetime @event.datetime.strftime('%Y %b %e %a %T') end
description()
click to toggle source
# File lib/parser/reporter.rb, line 33 def description if @event.unusual? ANSI.red { @event.description } else @event.description end end
user_name()
click to toggle source
# File lib/parser/reporter.rb, line 29 def user_name with_color { @event.user_name } end
with_color() { || ... }
click to toggle source
# File lib/parser/reporter.rb, line 41 def with_color ANSI.send(EVENT_TYPE_COLORS[@event.event_type]) { yield } end