/usr/lib/ruby/vendor_ruby/ffi-glib/array_methods.rb is in ruby-gir-ffi 0.9.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 | 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 || 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
|