Class Mutter::Mutterer
In: lib/mutter/mutterer.rb
Parent: Object

Methods

+   -   <<   >>   []   clear   color   color=   color?   esc   load   new   parse   print   process   reset   say   stream   stream=   styles   stylize   table   unstyle   write  

Public Class methods

Initialize the styles, and load the defaults from +styles.yml+

@active: currently active styles, which apply to the whole string @styles: contains all the user + default styles

Output stream (defaults to STDOUT)

  mostly for test purposes

Public Instance methods

Add and remove styles from the active styles

[](msg, *styles)

Alias for process

Escape a string, for later replacement

Loads styles from a YAML style-sheet,

  and converts the keys to symbols

Parse a string to ANSI codes

  if the glyph is a pair, we match [0] as the start
  and [1] as the end marker.
  the matches are sent to +stylize+
print(msg, *styles)

Alias for say

Parse the message, but also apply a style on the whole thing

reset(opt = :all)

Alias for clear

Apply styles to a string

  if the style is a default ANSI style, we add the start
  and end sequence to the string.

  if the style is a custom style, we recurse, sending
  the list of ANSI styles contained in the custom style.

  TODO: use ';' delimited codes instead of multiple \e sequences

Remove all tags from string

Write to the out stream, and flush it

[Validate]