Class: Logn::EventFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/logn.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(output) ⇒ EventFormatter

Returns a new instance of EventFormatter.



68
69
70
71
# File 'lib/logn.rb', line 68

def initialize(output)
  @output = output
  @height, @width = TermInfo.screen_size
end

Instance Attribute Details

#outputObject (readonly)

Returns the value of attribute output.



66
67
68
# File 'lib/logn.rb', line 66

def output
  @output
end

Instance Method Details



73
74
75
76
77
78
79
# File 'lib/logn.rb', line 73

def print(event)
  output.print event.timestamp.to_s.color(:yellow)
  output.print ' '
  output.print event.sender
  output.print ":#{event.event}" if event.event
  output.print "\n"
end