Class: Majo::Formatter::CSV
- Inherits:
-
Object
- Object
- Majo::Formatter::CSV
- Defined in:
- lib/majo/formatter/csv.rb
Instance Method Summary collapse
- #call ⇒ Object
- #groups ⇒ Object
-
#initialize(result) ⇒ CSV
constructor
A new instance of CSV.
Constructor Details
#initialize(result) ⇒ CSV
Returns a new instance of CSV.
6 7 8 |
# File 'lib/majo/formatter/csv.rb', line 6 def initialize(result) @result = result end |
Instance Method Details
#call ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/majo/formatter/csv.rb', line 10 def call ::CSV.generate do |csv| csv << ['Object class path', 'Class path', 'Method ID', 'Singleton method', 'Path', 'Line', 'Alloc generation', 'Free generation', 'Memsize', "Count"] groups.each do |row, count| csv << [row.object_class_path, row.class_path, row.method_id, row.singleton?, row.path, row.line, row.alloc_generation, row.free_generation, row.memsize, count] end end end |
#groups ⇒ Object
19 20 21 |
# File 'lib/majo/formatter/csv.rb', line 19 def groups [*@result.allocations, *@result.retained].tally end |