Class: String

Inherits:
Object
  • Object
show all
Defined in:
ext/encoding/character/utf-8/data/generate-unicode-data.rb,
lib/encoding/character/utf-8.rb

Instance Method Summary collapse

Instance Method Details

#+@Object



192
193
194
# File 'lib/encoding/character/utf-8.rb', line 192

def +@
  self.extend(Encoding::Character::UTF8::Methods)
end

#escapeObject



48
49
50
# File 'ext/encoding/character/utf-8/data/generate-unicode-data.rb', line 48

def escape
  self.unpack('H*')[0].gsub(/(.{2})/, '\\x\1')
end

#widthObject



52
53
54
# File 'ext/encoding/character/utf-8/data/generate-unicode-data.rb', line 52

def width
  self.gsub(/\t/, ' ' * 8).length
end