Class: HttpFind::Output

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

Constant Summary collapse

LINENUM_COLOR =
:light_black

Instance Method Summary collapse

Constructor Details

#initialize(matches) ⇒ Output

Returns a new instance of Output.



5
6
7
# File 'lib/http_find/output.rb', line 5

def initialize(matches)
  @matches = matches
end

Instance Method Details

#linesObject



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

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