class Object

Public Instance Methods

colorize(userInput) click to toggle source
# File lib/cgrep.rb, line 20
def colorize userInput
  expecs = @options[:patterns]

  _return = []

  expecs.each do |expec|
    pattern, color = expec.to_a.first
    if match = userInput.match(Regexp.new(pattern))
      userInput.gsub! match.to_s, Rainbow(match).send(color)
    end
  end

  userInput
end