Module: Wlog::TextFilters

Included in:
LogEntry
Defined in:
lib/wlog/tech/text_filters.rb

Overview

Author:

  • Simon Symeonidis

Instance Method Summary collapse

Instance Method Details

Use strmakers in order to color hyperlinks. This will look for a regex pattern of a http(s) link, and color it.

Parameters:

  • string

    is the string we want to look into and color

Returns:

  • the string with ansi colored links if ansi is set.



10
11
12
13
14
15
16
17
# File 'lib/wlog/tech/text_filters.rb', line 10

def highlight_hyperlink_s(string)
  @strmaker = SysConfig.string_decorator
  regex = /http(s)?:\S*|www.\S*/
  s = string.dup
  tmp = nil
  s.gsub!(regex) { @strmaker.blue($&) }
  s
end