Sha256: a29fce24461d3e49f001b7e6cc32fb5b0db2f0b6f63725d3591a73aabefbcda1
Contents?: true
Size: 765 Bytes
Versions: 2
Compression:
Stored size: 765 Bytes
Contents
require "cld/version" require "ffi" module CLD extend FFI::Library # Workaround FFI dylib/bundle issue. See https://github.com/ffi/ffi/issues/42 suffix = if FFI::Platform.mac? 'bundle' else FFI::Platform::LIBSUFFIX end ffi_lib File.join(File.expand_path(File.dirname(__FILE__)), '..', 'ext', 'cld', 'libcld2.' + suffix) def self.detect_language(text, is_plain_text=true) result = detect_language_ext(text.to_s, is_plain_text) Hash[ result.members.map {|member| [member.to_sym, result[member]]} ] end private class ReturnValue < FFI::Struct layout :name, :string, :code, :string, :reliable, :bool end attach_function "detect_language_ext", "detectLanguageThunkInt", [:buffer_in, :bool], ReturnValue.by_value end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cld2-1.0.3 | lib/cld.rb |
cld2-1.0.2 | lib/cld.rb |