method
reorder_characters
rails latest stable - Class:
ActiveSupport::Multibyte::Chars
Method deprecated or moved
This method is deprecated or moved on the latest stable version. The last existing version (v2.3.8) is shown here.
reorder_characters(codepoints)public
Re-order codepoints so the string becomes canonical.
# File activesupport/lib/active_support/multibyte/chars.rb, line 540
def reorder_characters(codepoints)
length = codepoints.length- 1
pos = 0
while pos < length do
cp1, cp2 = UCD.codepoints[codepoints[pos]], UCD.codepoints[codepoints[pos+1]]
if (cp1.combining_class > cp2.combining_class) && (cp2.combining_class > 0)
codepoints[pos..pos+1] = cp2.code, cp1.code
pos += (pos > 0 ? -1 : 1)
else
pos += 1
end
end
codepoints
end Related methods
- Instance methods
- +
- <=>
- =~
- []
- []=
- acts_like_string?
- capitalize
- center
- compose
- decompose
- downcase
- g_length
- include?
- index
- insert
- length
- ljust
- lstrip
- method_missing
- normalize
- ord
- respond_to?
- reverse
- rindex
- rjust
- rstrip
- size
- slice
- slice!
- split
- strip
- tidy_bytes
- upcase
- Class methods
- codepoints_to_pattern
- compose_codepoints
- consumes?
- decompose_codepoints
- g_pack
- g_unpack
- in_char_class?
- new
- new
- padding
- reorder_characters
- tidy_bytes
- u_unpack
- wants?
- Protected methods
-
apply_mapping -
chars -
justify -
translate_offset