MRuby library that provides complete API access to C libraries introspectable by GObjectIntropsection Bindings are dynamicaly generated as needed via usage of mruby-gobject-intropsection
Will also run on CRuby 1.9.x, mruby-gobject-intropsection's mrblib and ffi
are required.
(However this is a secondary objective as the primary target is mruby)
Several libraries exist to make common GObject based bindings more Ruby-like
Some niceness is built in mruby-girffi for GObject, Gtk >= 2.0, WebKit >= 1.0
Typically when the Rubyifcation of an api goes out the scope of core mruby-girffi I create these.
Thus far:
MRBGEMS:
- mruby-cfunc CFunc implementation for mruby
- mruby-rubyffi-compat A CRuby FFI compatable FFI implemention for mruby.
- mruby-gobject-introspection Bindings to libgirepository
- mruby-allocate Provides
Class#allocate
- mruby-named-constants Constants via
const_set(:Foo,Class.new)
returns the constant name forinspect
Libraries:
- libgirepository Allows to introspect
GObject
based libraries - libglib GLib
- libgobject The GObject type system
Data:
- GIRepository Typelibs for the bindings you wish to use.
GirFFI.setup :Gtk #, [2.0, 3.0][1] # specify a version
Gtk::init(1,["MRuby-GirFFI Application"])
w = Gtk::Window.new(Gtk::WindowType::TOPLEVEL)
w.add b=Gtk::Button.new_from_stock(Gtk::STOCK_QUIT)
b.signal_connect "clicked" do |widget, data_always_nil|
Gtk::main_quit
end
w.show_all()
Gtk::main()
- Built in enhancements for
GObject
,Gtk
andWebKit
- Ruby style method invokation.
(self, string_required, may_be_null, callback, out_param)
becomes(string, *o, &b)
. - Instantly write applications using the latest GObject based libraries. (nightly builds, even your own, if you compile your own typelibs)
- Generate documentation for built libraries with mruby-girffi-docgen
- A slight smell of
C
is left over - Differences compared to the CRuby Gtk2 official bindings (method arguments order may differ. Constant naming conventions may differ)
One needs girepository dev files
This builds the Regress-1.0 library
# build the test library, etc, and run
# gnerated files go to ./tmp
# expects mruby root to be one level above current dir
# ie: ../mruby
make test
# clean
make clean
- Makes no attempt to manage memory
Some will be implemented, but limited to instructions in typelibs.
ppibburr tulnor33@gmail.com
MIT