Module: Utf8Proc::StringExtensions

Included in:
String
Defined in:
lib/utf8proc.rb

Instance Method Summary collapse

Instance Method Details

#char_aryObject



76
77
78
79
# File 'lib/utf8proc.rb', line 76

def char_ary
  # depecated, use String#utf8chars instead
  utf8chars
end

#utf8charsObject



71
72
73
74
75
# File 'lib/utf8proc.rb', line 71

def utf8chars
  result = self.utf8map(:charbound).split("\377")
  result.shift if result.first == ""
  result
end

#utf8map(*option_array) ⇒ Object



50
51
52
53
54
55
56
57
58
59
# File 'lib/utf8proc.rb', line 50

def utf8map(*option_array)
  options = 0
  option_array.each do |option|
    flag = Utf8Proc::Options[option]
    raise ArgumentError, "Unknown argument given to String#utf8map." unless
      flag
    options |= flag
  end
  return Utf8Proc::utf8map(self, options)
end

#utf8map!(*option_array) ⇒ Object



60
61
62
# File 'lib/utf8proc.rb', line 60

def utf8map!(*option_array)
  self.replace(self.utf8map(*option_array))
end

#utf8nfcObject



65
# File 'lib/utf8proc.rb', line 65

def utf8nfc;   utf8map( :stable, :compose); end

#utf8nfc!Object



66
# File 'lib/utf8proc.rb', line 66

def utf8nfc!;  utf8map!(:stable, :compose); end

#utf8nfdObject



63
# File 'lib/utf8proc.rb', line 63

def utf8nfd;   utf8map( :stable, :decompose); end

#utf8nfd!Object



64
# File 'lib/utf8proc.rb', line 64

def utf8nfd!;  utf8map!(:stable, :decompose); end

#utf8nfkcObject



69
# File 'lib/utf8proc.rb', line 69

def utf8nfkc;  utf8map( :stable, :compose, :compat); end

#utf8nfkc!Object



70
# File 'lib/utf8proc.rb', line 70

def utf8nfkc!; utf8map!(:stable, :compose, :compat); end

#utf8nfkdObject



67
# File 'lib/utf8proc.rb', line 67

def utf8nfkd;  utf8map( :stable, :decompose, :compat); end

#utf8nfkd!Object



68
# File 'lib/utf8proc.rb', line 68

def utf8nfkd!; utf8map!(:stable, :decompose, :compat); end