class HTTPDisk::Grep::HeaderPrinter
header, then each match
Attributes
head[R]
printed[R]
Public Class Methods
new(output, head)
click to toggle source
Calls superclass method
HTTPDisk::Grep::Printer::new
# File lib/httpdisk/grep/printer.rb, line 60 def initialize(output, head) super(output) @head = head @printed = 0 end
Public Instance Methods
print(path, payload, all_matches)
click to toggle source
# File lib/httpdisk/grep/printer.rb, line 66 def print(path, payload, all_matches) # separator & filename output.puts if (@printed += 1) > 1 output.puts path # --head if head io = StringIO.new payload.write_header(io) io.string.lines.each { output.puts "< #{_1}" } end # matches all_matches.each { print_matches(_1) } end