Class: BaseFormatter
- Inherits:
-
Object
show all
- Defined in:
- lib/teuton/report/formatter/base_formatter.rb
Overview
Instance Method Summary
collapse
Constructor Details
Returns a new instance of BaseFormatter.
5
6
7
8
9
|
# File 'lib/teuton/report/formatter/base_formatter.rb', line 5
def initialize(report)
@head = report.head
@lines = report.lines
@tail = report.tail
end
|
Instance Method Details
#deinit ⇒ Object
24
25
26
|
# File 'lib/teuton/report/formatter/base_formatter.rb', line 24
def deinit
@file.close
end
|
#init(filename) ⇒ Object
11
12
13
14
|
# File 'lib/teuton/report/formatter/base_formatter.rb', line 11
def init(filename)
@filename = filename
@file = File.open(@filename, 'w')
end
|
#process ⇒ Object
20
21
22
|
# File 'lib/teuton/report/formatter/base_formatter.rb', line 20
def process
raise 'Empty method!'
end
|
#trim(input) ⇒ Object
28
29
30
31
32
|
# File 'lib/teuton/report/formatter/base_formatter.rb', line 28
def trim(input)
output = input.to_s
output = "...#{input[input.size - 50, input.size]}" if output.size > 65
output.to_s
end
|
#w(text) ⇒ Object
16
17
18
|
# File 'lib/teuton/report/formatter/base_formatter.rb', line 16
def w(text)
@file.write text.to_s
end
|