Module: Mutter

Defined in:
lib/mutter.rb,
lib/mutter/table.rb,
lib/mutter/indenter.rb,
lib/mutter/mutterer.rb

Defined Under Namespace

Classes: Indenter, Mutterer, Table

Constant Summary collapse

ANSI =

ANSI color & transform codes

If the value's an array,
[0] is the start code
and [1] is the end code.

Colors all have the same
reset code (39).
{
  :reset => 0,
  :transforms => {
    :bold      => [1, 22],
    :underline => [4, 24],
    :blink     => [5, 25],
    :inverse   => [7, 27]
  },
  :colors => {
    :black  => 30, :red    => 31,
    :green  => 32, :yellow => 33,
    :blue   => 34, :purple => 35,
    :cyan   => 36, :white  => 37,
    :reset  => 39
  }
}

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.indenter(tab) ⇒ Object



42
43
44
# File 'lib/mutter.rb', line 42

def self.indenter tab
  Indenter.new tab
end

.new(*args) ⇒ Object



58
59
60
# File 'lib/mutter.rb', line 58

def self.new *args
  Mutterer.new(*args)
end

.process(*args) ⇒ Object



54
55
56
# File 'lib/mutter.rb', line 54

def self.process *args
  new.process *args
end

.say(*args) ⇒ Object



46
47
48
# File 'lib/mutter.rb', line 46

def self.say *args
  new.say *args
end

.stylize(*args) ⇒ Object



50
51
52
# File 'lib/mutter.rb', line 50

def self.stylize *args
  new.stylize *args
end

Instance Method Details

#watchObject Also known as: oo

Utility function, to make a block interruptible



65
66
67
68
69
70
71
72
# File 'lib/mutter.rb', line 65

def watch
  begin
    yield
  rescue Interrupt
    puts
    exit 0
  end
end