Module: Utf8Proc::StringExtensions
- Included in:
- String
- Defined in:
- lib/utf8proc.rb
Instance Method Summary collapse
- #char_ary ⇒ Object
- #utf8chars ⇒ Object
- #utf8map(*option_array) ⇒ Object
- #utf8map!(*option_array) ⇒ Object
- #utf8nfc ⇒ Object
- #utf8nfc! ⇒ Object
- #utf8nfd ⇒ Object
- #utf8nfd! ⇒ Object
- #utf8nfkc ⇒ Object
- #utf8nfkc! ⇒ Object
- #utf8nfkd ⇒ Object
- #utf8nfkd! ⇒ Object
Instance Method Details
#char_ary ⇒ Object
76 77 78 79 |
# File 'lib/utf8proc.rb', line 76 def char_ary # depecated, use String#utf8chars instead utf8chars end |
#utf8chars ⇒ Object
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) = 0 option_array.each do |option| flag = Utf8Proc::Options[option] raise ArgumentError, "Unknown argument given to String#utf8map." unless flag |= flag end return Utf8Proc::utf8map(self, ) 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 |
#utf8nfc ⇒ Object
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 |
#utf8nfd ⇒ Object
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 |
#utf8nfkc ⇒ Object
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 |
#utf8nfkd ⇒ Object
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 |