Module: UTF8Proc
- Includes:
- JRuby
- Defined in:
- lib/utf8_proc/benchmark.rb,
lib/utf8_proc.rb,
lib/utf8_proc/jruby.rb,
lib/utf8_proc/version.rb,
ext/utf8_proc/utf8_proc.c
Overview
rubocop:disable MethodLength
Defined Under Namespace
Modules: Benchmark, JRuby, StringExtension
Constant Summary collapse
- VERSION =
"0.5.2".freeze
- LIBRARY_VERSION =
rb_str_freeze( rb_enc_str_new(libVersion, strlen(libVersion), enc_utf8) )
Class Method Summary collapse
-
.NFC(string) ⇒ Object
NFC.
-
.NFD(string) ⇒ Object
NFD.
-
.NFKC(string) ⇒ Object
NFKC.
-
.NFKC_CF(string) ⇒ Object
NFKC_CF.
-
.NFKD(string) ⇒ Object
NFKD.
-
.normalize(*args) ⇒ Object
Parameterized normalization.
Methods included from JRuby
Class Method Details
.NFC(string) ⇒ Object
NFC
70 71 72 |
# File 'ext/utf8_proc/utf8_proc.c', line 70
static VALUE toNFC(VALUE self, VALUE string) {
return normInternal(&string, UTF8PROC_STABLE | UTF8PROC_COMPOSE);
}
|
.NFD(string) ⇒ Object
NFD
80 81 82 |
# File 'ext/utf8_proc/utf8_proc.c', line 80
static VALUE toNFD(VALUE self, VALUE string) {
return normInternal(&string, UTF8PROC_STABLE | UTF8PROC_DECOMPOSE);
}
|
.NFKC(string) ⇒ Object
NFKC
90 91 92 |
# File 'ext/utf8_proc/utf8_proc.c', line 90
static VALUE toNFKC(VALUE self, VALUE string) {
return normInternal(&string, UTF8PROC_STABLE | UTF8PROC_COMPOSE | UTF8PROC_COMPAT);
}
|
.NFKC_CF(string) ⇒ Object
NFKC_CF
110 111 112 |
# File 'ext/utf8_proc/utf8_proc.c', line 110
static VALUE toNFKC_CF(VALUE self, VALUE string) {
return normInternal(&string, UTF8PROC_STABLE | UTF8PROC_COMPOSE | UTF8PROC_COMPAT | UTF8PROC_CASEFOLD);
}
|
.NFKD(string) ⇒ Object
NFKD
100 101 102 |
# File 'ext/utf8_proc/utf8_proc.c', line 100
static VALUE toNFKD(VALUE self, VALUE string) {
return normInternal(&string, UTF8PROC_STABLE | UTF8PROC_DECOMPOSE | UTF8PROC_COMPAT);
}
|
.normalize(*args) ⇒ Object
Parameterized normalization
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'ext/utf8_proc/utf8_proc.c', line 120
static VALUE toNorm(int argc, VALUE* argv, VALUE self){
VALUE string;
VALUE form;
rb_scan_args(argc, argv, "11", &string, &form);
if (NIL_P(form)) {
return normInternal(&string, UTF8PROC_STABLE | UTF8PROC_COMPOSE);
}
ID s_form;
s_form = SYM2ID(form);
if (s_form == NFC) {
return normInternal(&string, UTF8PROC_STABLE | UTF8PROC_COMPOSE);
} else if (s_form == NFD) {
return normInternal(&string, UTF8PROC_STABLE | UTF8PROC_DECOMPOSE);
} else if (s_form == NFKC) {
return normInternal(&string, UTF8PROC_STABLE | UTF8PROC_COMPOSE | UTF8PROC_COMPAT);
} else if (s_form == NFKD) {
return normInternal(&string, UTF8PROC_STABLE | UTF8PROC_DECOMPOSE | UTF8PROC_COMPAT);
} else if (s_form == NFKC_CF) {
return normInternal(&string, UTF8PROC_STABLE | UTF8PROC_COMPOSE | UTF8PROC_COMPAT | UTF8PROC_CASEFOLD);
} else {
rb_raise(rb_eArgError, "%s",
"Second argument must be one of [:nfc (default), :nfd, :nfkc, " \
":nfkd, :nfkc_cf]");
}
}
|