Class: Logn::EventFormatter
- Inherits:
-
Object
- Object
- Logn::EventFormatter
- Defined in:
- lib/logn.rb
Instance Attribute Summary collapse
-
#output ⇒ Object
readonly
Returns the value of attribute output.
Instance Method Summary collapse
-
#initialize(output) ⇒ EventFormatter
constructor
A new instance of EventFormatter.
- #print(event) ⇒ Object
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
#output ⇒ Object (readonly)
Returns the value of attribute output.
66 67 68 |
# File 'lib/logn.rb', line 66 def output @output end |
Instance Method Details
#print(event) ⇒ Object
73 74 75 76 77 78 79 |
# File 'lib/logn.rb', line 73 def print(event) output.print event..to_s.color(:yellow) output.print ' ' output.print event.sender output.print ":#{event.event}" if event.event output.print "\n" end |