Class: BaseFormatter
- Inherits:
-
Object
show all
- Defined in:
- lib/teuton/report/formatter/base_formatter.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
4
5
6
7
8
9
|
# File 'lib/teuton/report/formatter/base_formatter.rb', line 4
def initialize(report)
@head = report.head.clone
@lines = report.lines.clone
@tail = report.tail.clone
@ext = "unkown"
end
|
Instance Attribute Details
#ext ⇒ Object
Returns the value of attribute ext.
2
3
4
|
# File 'lib/teuton/report/formatter/base_formatter.rb', line 2
def ext
@ext
end
|
Instance Method Details
#deinit ⇒ Object
27
28
29
|
# File 'lib/teuton/report/formatter/base_formatter.rb', line 27
def deinit
@file.close
end
|
#init(filename) ⇒ Object
15
16
17
18
|
# File 'lib/teuton/report/formatter/base_formatter.rb', line 15
def init(filename)
@filename = "#{filename}.#{@ext}"
@file = File.open(@filename, "w")
end
|
#process(options = {}) ⇒ Object
11
12
13
|
# File 'lib/teuton/report/formatter/base_formatter.rb', line 11
def process(options = {})
raise "Empty method!"
end
|
#trim(input) ⇒ Object
31
32
33
34
35
|
# File 'lib/teuton/report/formatter/base_formatter.rb', line 31
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
23
24
25
|
# File 'lib/teuton/report/formatter/base_formatter.rb', line 23
def w(text)
@file.write text.to_s
end
|