glib2 provides Ruby bindings to GLib, the foundational library underlying GNOME and GTK applications. GLib offers core data structures, event loops, threading abstractions, and utility functions that form the basis of GTK-based applications. The gem brings GLib's object system, signal/callback mechanisms, and main event loop to Ruby, enabling integration with GTK applications and other GLib-based libraries.
The library exposes GLib's type system and GObject introspection, allowing Ruby to work with GLib-based C libraries dynamically without hand-written bindings for every function. It provides Ruby-friendly wrappers for GLib data structures like arrays and hash tables, implements signal connection and emission for event-driven programming, and handles the GLib main loop for event processing. glib2 includes support for GLib's property system, marshalling between Ruby and C types, and integration with GLib's reference counting and memory management.
glib2 serves as the foundation for the ruby-gnome suite of libraries including gtk3, gdk_pixbuf2, pango, and other GNOME bindings. It's essential for Ruby applications with GTK user interfaces, system integration requiring GLib APIs, or tools using GObject-introspected libraries. The gem enables Ruby desktop applications on Linux, cross-platform GUI tools using GTK, and scripts that need to interact with GNOME services or D-Bus interfaces. Its GObject introspection support makes it possible to use many GLib-based libraries from Ruby without writing explicit bindings.
gem install glib2 Run this gem instantly in your browser without any installation:
Open in RunRuby.dev →All 126 versions available for installation