Class: GhSearch::Formatters::Plain
- Inherits:
-
Base
- Object
- Base
- GhSearch::Formatters::Plain
show all
- Defined in:
- lib/gh_search/formatters/plain.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
4
5
6
7
8
9
10
11
12
13
14
|
# File 'lib/gh_search/formatters/plain.rb', line 4
def write(match)
text = [match[:repo_name], match[:path], match[:linenumber], match[:text], "\n"].join(' ')
if output_file
@file ||= File.open(output_file, "w")
@file.write text
print_and_flush('.')
else
puts text
end
end
|
#write_file! ⇒ Object
16
17
18
|
# File 'lib/gh_search/formatters/plain.rb', line 16
def write_file!
@file.close if @file
end
|