Module: FFILocale

Extended by:
FFI::Library
Defined in:
lib/ffi-locale/ffi-locale.rb

Class Method Summary collapse

Class Method Details

.getlocaleinfoObject


25
26
27
28
# File 'lib/ffi-locale/ffi-locale.rb', line 25

def self.getlocaleinfo
  info = setlocale LC_ALL, nil
  locale_hash(info)
end

.strxfrm(src) ⇒ Object


30
31
32
33
34
35
36
37
38
# File 'lib/ffi-locale/ffi-locale.rb', line 30

def self.strxfrm(src)
  length = strxfrm_C(nil, src, 0)
  result = ""
  FFI::MemoryPointer.new(length+1) do |dest|
    strxfrm_C(dest, src, length)
    result = dest.read_string
  end
  result
end