Да, но не очень полезно.
Вот полностью функциональный пример:
require 'ffi'
module ObjC
extend FFI::Library
ffi_lib 'objc'
attach_function :sel_registerName, [:string], :pointer
attach_function :objc_msgSend, [:pointer, :pointer, :varargs], :pointer
def self.msgSend( id, selector, *args )
selector = sel_registerName(selector) if selector.is_a? String
return objc_msgSend( id, selector, *args )
end
attach_function :objc_getClass, [:string], :pointer
end
module Cocoa
extend FFI::Library
ffi_lib '/System/Library/Frameworks/Cocoa.framework/Cocoa'
attach_function :NSApplicationLoad, [], :bool
NSApplicationLoad()
end
pool = ObjC.msgSend(ObjC.msgSend(ObjC.objc_getClass("NSAutoreleasePool"),"alloc"),"init")
application = ObjC.msgSend(ObjC.objc_getClass("NSApplication"),"sharedApplication")
ObjC.msgSend(application,"run")