Class: AnsiArt::Buffer

Inherits:
Array
  • Object
show all
Defined in:
lib/ansi_art/buffer.rb

Instance Method Summary collapse

Constructor Details

#initializeBuffer

Returns a new instance of Buffer.



3
4
5
# File 'lib/ansi_art/buffer.rb', line 3

def initialize
  super
end

Instance Method Details

#conv(str) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/ansi_art/buffer.rb', line 7

def conv str
  str.encode! 'utf-8','big5-uao',{:invalid => :replace, :undef => :replace}

  # Patch for special chars
  str.tr!("\u00AF","\u203E")

  str
end

#to_sObject



16
17
18
# File 'lib/ansi_art/buffer.rb', line 16

def to_s
  return conv(self.pack('C*'))
end

#to_s!Object

to string and clean up



20
21
22
23
24
# File 'lib/ansi_art/buffer.rb', line 20

def to_s! # to string and clean up
  output = self.to_s
  self.clear
  return output
end