Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/u.rb,
lib/encoding/character/utf-8.rb,
ext/encoding/character/utf-8/data/generate-unicode-data.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

#uObject



9
10
11
# File 'lib/u.rb', line 9

def u
  dup.u!
end

#u!Object



13
14
15
# File 'lib/u.rb', line 13

def u!
  self.extend(U::String)
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