gi: use Object#to_enum instead of Enumerator.new

Because Enumerator.new is deprecated.