Class: ActiveSupport::Multibyte::Handlers::UTF8HandlerProc
- Inherits:
-
UTF8Handler
- Object
- UTF8Handler
- ActiveSupport::Multibyte::Handlers::UTF8HandlerProc
- Defined in:
- lib/unicodechars/multibyte/handlers/utf8_handler_proc.rb
Overview
Methods in this handler call functions in the utf8proc ruby extension. These are significantly faster than the pure ruby versions. Chars automatically uses this handler when it can load the utf8proc extension. For documentation on handler methods see UTF8Handler.
Constant Summary
Constants inherited from UTF8Handler
ActiveSupport::Multibyte::Handlers::UTF8Handler::HANGUL_JAMO_FIRST, ActiveSupport::Multibyte::Handlers::UTF8Handler::HANGUL_JAMO_LAST, ActiveSupport::Multibyte::Handlers::UTF8Handler::HANGUL_LBASE, ActiveSupport::Multibyte::Handlers::UTF8Handler::HANGUL_LCOUNT, ActiveSupport::Multibyte::Handlers::UTF8Handler::HANGUL_NCOUNT, ActiveSupport::Multibyte::Handlers::UTF8Handler::HANGUL_SBASE, ActiveSupport::Multibyte::Handlers::UTF8Handler::HANGUL_SCOUNT, ActiveSupport::Multibyte::Handlers::UTF8Handler::HANGUL_SLAST, ActiveSupport::Multibyte::Handlers::UTF8Handler::HANGUL_TBASE, ActiveSupport::Multibyte::Handlers::UTF8Handler::HANGUL_TCOUNT, ActiveSupport::Multibyte::Handlers::UTF8Handler::HANGUL_VBASE, ActiveSupport::Multibyte::Handlers::UTF8Handler::HANGUL_VCOUNT, ActiveSupport::Multibyte::Handlers::UTF8Handler::UNICODE_LEADERS_AND_TRAILERS, ActiveSupport::Multibyte::Handlers::UTF8Handler::UNICODE_LEADERS_PAT, ActiveSupport::Multibyte::Handlers::UTF8Handler::UNICODE_TRAILERS_PAT, ActiveSupport::Multibyte::Handlers::UTF8Handler::UNICODE_WHITESPACE, ActiveSupport::Multibyte::Handlers::UTF8Handler::UTF8_PAT
Class Method Summary collapse
-
.decompose(str) ⇒ Object
:nodoc:.
-
.downcase(str) ⇒ Object
:nodoc:c.
-
.normalize(str, form = ActiveSupport::Multibyte::DEFAULT_NORMALIZATION_FORM) ⇒ Object
:nodoc:.
Methods inherited from UTF8Handler
capitalize, codepoints_to_pattern, compose, consumes?, g_length, index, insert, lstrip, reverse, rstrip, size, slice, strip, tidy_bytes, translate_offset, upcase
Class Method Details
.decompose(str) ⇒ Object
:nodoc:
23 24 25 |
# File 'lib/unicodechars/multibyte/handlers/utf8_handler_proc.rb', line 23 def decompose(str) #:nodoc: utf8map(str, :stable) end |
.downcase(str) ⇒ Object
:nodoc:c
27 28 29 |
# File 'lib/unicodechars/multibyte/handlers/utf8_handler_proc.rb', line 27 def downcase(str) #:nodoc:c utf8map(str, :casefold) end |
.normalize(str, form = ActiveSupport::Multibyte::DEFAULT_NORMALIZATION_FORM) ⇒ Object
:nodoc:
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/unicodechars/multibyte/handlers/utf8_handler_proc.rb', line 7 def normalize(str, form=ActiveSupport::Multibyte::DEFAULT_NORMALIZATION_FORM) #:nodoc: codepoints = str.unpack('U*') case form when :d utf8map(str, :stable) when :c utf8map(str, :stable, :compose) when :kd utf8map(str, :stable, :compat) when :kc utf8map(str, :stable, :compose, :compat) else raise ArgumentError, "#{form} is not a valid normalization variant", caller end end |