Class: HttpFind::Output
- Inherits:
-
Object
- Object
- HttpFind::Output
- Defined in:
- lib/http_find/output.rb
Constant Summary collapse
- LINENUM_COLOR =
:light_black
Instance Method Summary collapse
-
#initialize(matches) ⇒ Output
constructor
A new instance of Output.
- #lines ⇒ Object
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
#lines ⇒ Object
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 |