Module: Utf8Proc::StringExtensions

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

Instance Method Summary collapse

Instance Method Details

#char_aryObject



90
91
92
93
# File 'lib/utf8proc.rb', line 90

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

#utf8charsObject



85
86
87
88
89
# File 'lib/utf8proc.rb', line 85

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

#utf8map(*option_array) ⇒ Object



64
65
66
67
68
69
70
71
72
73
# File 'lib/utf8proc.rb', line 64

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



74
75
76
# File 'lib/utf8proc.rb', line 74

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

#utf8nfcObject



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

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

#utf8nfc!Object



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

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

#utf8nfdObject



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

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

#utf8nfd!Object



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

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

#utf8nfkcObject



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

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

#utf8nfkc!Object



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

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

#utf8nfkdObject



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

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

#utf8nfkd!Object



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

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