Module: Encoding::Character::UTF8::Methods

Defined in:
lib/encoding/character/utf-8.rb,
ext/encoding/character/utf-8/unicode.c

Overview

TODO: Rework this to use a dispatch object instead, so that the encoding can be changed on the fly. TODO: Add String#encoding.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.def_thunk_replacing_variant(method) ⇒ Object



11
12
13
14
15
# File 'lib/encoding/character/utf-8.rb', line 11

def self.def_thunk_replacing_variant(method)
  define_method(:"#{method}!") do
    replace(send(method))
  end
end

Instance Method Details

#<=>(other) ⇒ Object



17
18
19
# File 'lib/encoding/character/utf-8.rb', line 17

def <=>(other)
  Encoding::Character::UTF8.collate(self, other)
end

#[](*args) ⇒ Object



21
22
23
# File 'lib/encoding/character/utf-8.rb', line 21

def [](*args)
  Encoding::Character::UTF8.aref(self, *args)
end

#[]=(*args) ⇒ Object



29
30
31
# File 'lib/encoding/character/utf-8.rb', line 29

def []=(*args)
  Encoding::Character::UTF8.aset(self, *args)
end

#capitalizeObject



172
173
174
# File 'lib/encoding/character/utf-8.rb', line 172

def capitalize
  self[0].upcase + self[1..-1].downcase
end

#casecmp(other) ⇒ Object



33
34
35
# File 'lib/encoding/character/utf-8.rb', line 33

def casecmp(other)
  Encoding::Character::UTF8.casecmp(self, other)
end

#center(*args) ⇒ Object



37
38
39
# File 'lib/encoding/character/utf-8.rb', line 37

def center(*args)
  Encoding::Character::UTF8.center(self, *args)
end

#chomp(*args) ⇒ Object



41
42
43
# File 'lib/encoding/character/utf-8.rb', line 41

def chomp(*args)
  Encoding::Character::UTF8.chomp(self, *args)
end

#chomp!(*args) ⇒ Object



45
46
47
# File 'lib/encoding/character/utf-8.rb', line 45

def chomp!(*args)
  Encoding::Character::UTF8.chomp!(self, *args)
end

#chopObject



49
50
51
# File 'lib/encoding/character/utf-8.rb', line 49

def chop
  Encoding::Character::UTF8.chop(self)
end

#chop!Object



53
54
55
# File 'lib/encoding/character/utf-8.rb', line 53

def chop!
  Encoding::Character::UTF8.chop!(self)
end

#count(*args) ⇒ Object



57
58
59
# File 'lib/encoding/character/utf-8.rb', line 57

def count(*args)
  Encoding::Character::UTF8.count(self, *args)
end

#delete(*args) ⇒ Object



61
62
63
# File 'lib/encoding/character/utf-8.rb', line 61

def delete(*args)
  Encoding::Character::UTF8.delete(self, *args)
end

#delete!(*args) ⇒ Object



65
66
67
# File 'lib/encoding/character/utf-8.rb', line 65

def delete!(*args)
  Encoding::Character::UTF8.delete!(self, *args)
end

#downcaseObject



69
70
71
# File 'lib/encoding/character/utf-8.rb', line 69

def downcase
  Encoding::Character::UTF8.downcase(self)
end

#each_char(&block) ⇒ Object



74
75
76
# File 'lib/encoding/character/utf-8.rb', line 74

def each_char(&block)
  Encoding::Character::UTF8.each_char(self, &block)
end

#foldcaseObject



177
178
179
# File 'lib/encoding/character/utf-8.rb', line 177

def foldcase
  Encoding::Character::UTF8.foldcase(self)
end

#index(*args) ⇒ Object



78
79
80
# File 'lib/encoding/character/utf-8.rb', line 78

def index(*args)
  Encoding::Character::UTF8.index(self, *args)
end

#insert(index, other) ⇒ Object



82
83
84
# File 'lib/encoding/character/utf-8.rb', line 82

def insert(index, other)
  Encoding::Character::UTF8.insert(self, index, other)
end

#inspectObject



155
156
157
# File 'lib/encoding/character/utf-8.rb', line 155

def inspect
  "u#{_inspect}"
end

#lengthObject



86
87
88
# File 'lib/encoding/character/utf-8.rb', line 86

def length
  Encoding::Character::UTF8.length(self)
end

#ljust(*args) ⇒ Object



159
160
161
# File 'lib/encoding/character/utf-8.rb', line 159

def ljust(*args)
  Encoding::Character::UTF8.ljust(self, *args)
end

#lstripObject



90
91
92
# File 'lib/encoding/character/utf-8.rb', line 90

def lstrip
  Encoding::Character::UTF8.lstrip(self)
end

#lstrip!Object



94
95
96
# File 'lib/encoding/character/utf-8.rb', line 94

def lstrip!
  Encoding::Character::UTF8.lstrip!(self)
end

#normalize(*args) ⇒ Object



98
99
100
# File 'lib/encoding/character/utf-8.rb', line 98

def normalize(*args)
  Encoding::Character::UTF8.normalize(self, *args)
end

#reverseObject



114
115
116
# File 'lib/encoding/character/utf-8.rb', line 114

def reverse
  Encoding::Character::UTF8.reverse(self)
end

#rindex(*args) ⇒ Object



102
103
104
# File 'lib/encoding/character/utf-8.rb', line 102

def rindex(*args)
  Encoding::Character::UTF8.rindex(self, *args)
end

#rjust(*args) ⇒ Object



163
164
165
# File 'lib/encoding/character/utf-8.rb', line 163

def rjust(*args)
  Encoding::Character::UTF8.rjust(self, *args)
end

#rstripObject



106
107
108
# File 'lib/encoding/character/utf-8.rb', line 106

def rstrip
  Encoding::Character::UTF8.rstrip(self)
end

#rstrip!Object



110
111
112
# File 'lib/encoding/character/utf-8.rb', line 110

def rstrip!
  Encoding::Character::UTF8.rstrip!(self)
end

#slice(*args) ⇒ Object



25
26
27
# File 'lib/encoding/character/utf-8.rb', line 25

def slice(*args)
  Encoding::Character::UTF8.aref(self, *args)
end

#squeezeObject



119
120
121
# File 'lib/encoding/character/utf-8.rb', line 119

def squeeze
  Encoding::Character::UTF8.squeeze(self)
end

#squeeze!Object



123
124
125
# File 'lib/encoding/character/utf-8.rb', line 123

def squeeze!
  Encoding::Character::UTF8.squeeze!(self)
end

#stripObject



127
128
129
# File 'lib/encoding/character/utf-8.rb', line 127

def strip
  Encoding::Character::UTF8.strip(self)
end

#strip!Object



131
132
133
# File 'lib/encoding/character/utf-8.rb', line 131

def strip!
  Encoding::Character::UTF8.strip!(self)
end

#to_i(*args) ⇒ Object



135
136
137
# File 'lib/encoding/character/utf-8.rb', line 135

def to_i(*args)
  Encoding::Character::UTF8.to_i(self, *args)
end

#tr(from, to) ⇒ Object



139
140
141
# File 'lib/encoding/character/utf-8.rb', line 139

def tr(from, to)
  Encoding::Character::UTF8.tr(self, from, to)
end

#tr!(from, to) ⇒ Object



143
144
145
# File 'lib/encoding/character/utf-8.rb', line 143

def tr!(from, to)
  replace(tr(from, to))
end

#tr_s(from, to) ⇒ Object



147
148
149
# File 'lib/encoding/character/utf-8.rb', line 147

def tr_s(from, to)
  Encoding::Character::UTF8.tr_s(self, from, to)
end

#tr_s!(from, to) ⇒ Object



151
152
153
# File 'lib/encoding/character/utf-8.rb', line 151

def tr_s!(from, to)
  replace(tr_s(from, to))
end

#upcaseObject



167
168
169
# File 'lib/encoding/character/utf-8.rb', line 167

def upcase
  Encoding::Character::UTF8.upcase(self)
end