module ICU::Collation

Public Class Methods

available_locales() click to toggle source
# File lib/ffi-icu/collation.rb, line 23
def self.available_locales
  (0...Lib.ucol_countAvailable).map do |idx|
    Lib.ucol_getAvailable idx
  end
end
collate(locale, arr) click to toggle source
# File lib/ffi-icu/collation.rb, line 4
def self.collate(locale, arr)
  Collator.new(locale).collate(arr)
end
keywords() click to toggle source
# File lib/ffi-icu/collation.rb, line 8
def self.keywords
  enum_ptr = Lib.check_error { |error| Lib.ucol_getKeywords(error) }
  keywords = Lib.enum_ptr_to_array(enum_ptr)
  Lib.uenum_close enum_ptr

  hash = {}
  keywords.each do |keyword|
    enum_ptr = Lib.check_error { |error| Lib.ucol_getKeywordValues(keyword, error) }
    hash[keyword] = Lib.enum_ptr_to_array(enum_ptr)
    Lib.uenum_close(enum_ptr)
  end

  hash
end