@@ -4,21 +4,23 @@ require "json"
4
4
# Minimal TDLib FFI wrapper, tdlib-ruby is conflict with
5
5
# telegram-bot-ruby as they depends on dry-core
6
6
module TDJson
7
- extend FFI ::Library
8
- lib_name = "tdjson"
9
- if FFI ::Platform . windows?
10
- ffi_lib File . join ( ENV . fetch ( "TDLIB_PATH" ) , "#{ lib_name } .dll" )
11
- elsif FFI ::Platform . mac?
12
- ffi_lib File . join ( ENV . fetch ( "TDLIB_PATH" ) , "lib#{ lib_name } .dylib" )
13
- else
14
- ffi_lib File . join ( ENV . fetch ( "TDLIB_PATH" ) , "lib#{ lib_name } .so" )
15
- end
7
+ if Rails . env . development?
8
+ extend FFI ::Library
9
+ lib_name = "tdjson"
10
+ if FFI ::Platform . windows?
11
+ ffi_lib File . join ( ENV . fetch ( "TDLIB_PATH" ) , "#{ lib_name } .dll" )
12
+ elsif FFI ::Platform . mac?
13
+ ffi_lib File . join ( ENV . fetch ( "TDLIB_PATH" ) , "lib#{ lib_name } .dylib" )
14
+ else
15
+ ffi_lib File . join ( ENV . fetch ( "TDLIB_PATH" ) , "lib#{ lib_name } .so" )
16
+ end
16
17
17
- attach_function :td_json_client_create , [ ] , :pointer
18
- attach_function :td_json_client_send , [ :pointer , :string ] , :void
19
- attach_function :td_json_client_receive , [ :pointer , :double ] , :string
20
- attach_function :td_json_client_execute , [ :pointer , :string ] , :string
21
- attach_function :td_json_client_destroy , [ :pointer ] , :void
18
+ attach_function :td_json_client_create , [ ] , :pointer
19
+ attach_function :td_json_client_send , [ :pointer , :string ] , :void
20
+ attach_function :td_json_client_receive , [ :pointer , :double ] , :string
21
+ attach_function :td_json_client_execute , [ :pointer , :string ] , :string
22
+ attach_function :td_json_client_destroy , [ :pointer ] , :void
23
+ end
22
24
end
23
25
24
26
class TDClient
0 commit comments