Class: HttpFind::Output

Inherits:
Object
  • Object
show all
Defined in:
lib/http_find/output.rb

Instance Method Summary collapse

Constructor Details

#initialize(matches) ⇒ Output

Returns a new instance of Output.



3
4
5
# File 'lib/http_find/output.rb', line 3

def initialize(matches)
  @matches = matches
end

Instance Method Details

#linesObject



7
8
9
10
11
12
13
14
# File 'lib/http_find/output.rb', line 7

def lines
  justlen = @matches.map { |m| m[:line] }.sort.last.to_s.length
  @matches.map do |m|
    line = m[:line].to_s
    text = m[:text]
    "#{line.rjust(justlen)} | #{text}"
  end
end