Sha256: b746f5eba3d21648344cf90325f9b133c72135c3fb141d8deb78d10151e3f76f
Contents?: true
Size: 423 Bytes
Versions: 6
Compression:
Stored size: 423 Bytes
Contents
module GLib # Common methods for GLib::Array and GLib::PtrArray module ArrayMethods # Re-implementation of the g_array_index and g_ptr_array_index macros def index idx if idx >= length or idx < 0 raise IndexError, "Index #{idx} outside of bounds 0..#{length - 1}" end ptr = GirFFI::InOutPointer.new element_type, data_ptr + idx * element_size ptr.to_ruby_value end end end
Version data entries
6 entries across 6 versions & 1 rubygems