Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/ansi/core.rb

Instance Method Summary collapse

Instance Method Details

#ansi(*codes) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/ansi/core.rb', line 7

def ansi(*codes)
  if codes.empty?
    ANSI::Chain.new(self)
  else
    ANSI::Code.ansi(self, *codes)
  end
end

#ansi!(*codes) ⇒ Object



16
17
18
# File 'lib/ansi/core.rb', line 16

def ansi!(*codes)
  replace(ansi(*codes))
end

#unansiObject



21
22
23
# File 'lib/ansi/core.rb', line 21

def unansi
  ANSI::Code.unansi(self)
end

#unansi!Object



26
27
28
# File 'lib/ansi/core.rb', line 26

def unansi!
  replace(unansi)
end