class RubySearch::Formatter

Public Instance Methods

print() { |to_str| ... } click to toggle source
to_str() click to toggle source
# File lib/ruby_search/formatter.rb, line 5
def to_str
  string = ''
  string << "====#{file}\n".colorize(:cyan)
  matches.each do |match, i|
    string << i.to_s
    string << "\t"
    string << [
      match.pre_match,
      match.to_s.colorize(:red),
      match.post_match
    ].join.chomp
    string << "\n"
  end
  string
end