Module: Doing::StringHighlight

Included in:
String
Defined in:
lib/doing/string/highlight.rb

Overview

Tag and search highlighting

Instance Method Summary collapse

Instance Method Details

#highlight_search(search, distance: nil, negate: false, case_type: nil) ⇒ Object

#highlight_search!(search, distance: nil, negate: false, case_type: nil) ⇒ Object

#highlight_tags(color = 'yellow', last_color: nil) ⇒ String

Colorize @tags with ANSI escapes

Parameters:

  • color (String) (defaults to: 'yellow')

    color (see #Color)

Returns:

  • (String)

    string with @tags highlighted

#highlight_tags!(color = 'yellow', last_color: nil) ⇒ Object

Parameters:

  • color (String) (defaults to: 'yellow')

    color (see #Color)

#last_colorString

Returns the last escape sequence from a string.

Actually returns all escape codes, with the assumption that the result of inserting them will generate the same color as was set at the end of the string. Because you can send modifiers like dark and bold separate from color codes, only using the last code may not render the same style.

Returns:

  • (String)

    All escape codes in string

#uncolorObject

Remove color escape codes

Returns:

  • clean string

#uncolor!Object

See Also: