Class: GhSearch::Formatters::Csv
- Inherits:
-
Base
- Object
- Base
- GhSearch::Formatters::Csv
show all
- Defined in:
- lib/gh_search/formatters/csv.rb
Instance Attribute Summary
Attributes inherited from Base
#output_file
Instance Method Summary
collapse
Methods inherited from Base
#initialize, #write!
Instance Method Details
#write(match) ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/gh_search/formatters/csv.rb', line 6
def write(match)
if output_file
@file ||= CSV.open(output_file, "w")
unless
= match.keys
@file <<
end
@file << match.values
print_and_flush('.')
else
unless
= match.keys
puts .join(',')
end
puts match.values.join(',')
end
end
|
#write_file! ⇒ Object
26
27
28
|
# File 'lib/gh_search/formatters/csv.rb', line 26
def write_file!
@file.close if @file
end
|