Class: BaseFormatter
- Inherits:
-
Object
show all
- Defined in:
- lib/teuton/report/formatter/base_formatter.rb
Instance Method Summary
collapse
Constructor Details
Returns a new instance of BaseFormatter.
4
5
6
7
8
|
# File 'lib/teuton/report/formatter/base_formatter.rb', line 4
def initialize(report)
@head = report.head
@lines = report.lines
@tail = report.tail
end
|
Instance Method Details
#deinit ⇒ Object
26
27
28
|
# File 'lib/teuton/report/formatter/base_formatter.rb', line 26
def deinit
@file.close
end
|
#init(filename) ⇒ Object
14
15
16
17
|
# File 'lib/teuton/report/formatter/base_formatter.rb', line 14
def init(filename)
@filename = filename
@file = File.open(@filename, "w")
end
|
#process ⇒ Object
10
11
12
|
# File 'lib/teuton/report/formatter/base_formatter.rb', line 10
def process
raise "Empty method!"
end
|
#trim(input) ⇒ Object
30
31
32
33
34
|
# File 'lib/teuton/report/formatter/base_formatter.rb', line 30
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
Write data into output file
22
23
24
|
# File 'lib/teuton/report/formatter/base_formatter.rb', line 22
def w(text)
@file.write text.to_s
end
|