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.
2
3
4
5
6
7
|
# File 'lib/teuton/report/formatter/base_formatter.rb', line 2
def initialize(report)
@head = report.head.clone
@lines = report.lines.clone
@tail = report.tail.clone
@ext = "unkown"
end
|
Instance Method Details
#deinit ⇒ Object
25
26
27
|
# File 'lib/teuton/report/formatter/base_formatter.rb', line 25
def deinit
@file.close
end
|
#init(filename) ⇒ Object
13
14
15
16
|
# File 'lib/teuton/report/formatter/base_formatter.rb', line 13
def init(filename)
@filename = "#{filename}.#{@ext}"
@file = File.open(@filename, "w")
end
|
#process(options = {}) ⇒ Object
9
10
11
|
# File 'lib/teuton/report/formatter/base_formatter.rb', line 9
def process(options = {})
raise "Empty method!"
end
|
#trim(input) ⇒ Object
29
30
31
32
33
|
# File 'lib/teuton/report/formatter/base_formatter.rb', line 29
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
21
22
23
|
# File 'lib/teuton/report/formatter/base_formatter.rb', line 21
def w(text)
@file.write text.to_s
end
|