/usr/lib/ruby/vendor_ruby/gobject-introspection/callable-info.rb is in ruby-gobject-introspection 2.2.5-4build1.
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 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | # Copyright (C) 2013 Ruby-GNOME2 Project Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
require "gobject-introspection/collection-reader"
module GObjectIntrospection
class CallableInfo
extend CollectionReader
collection_reader("args")
def in_args
array_length_indexes = []
callback_indexes = []
closure_indexes = []
destroy_indexes = []
args.each_with_index do |arg, i|
if arg.type.tag == TypeTag::ARRAY
array_length = arg.type.array_length
array_length_indexes << array_length if array_length != -1
end
unless arg.scope == ScopeType::INVALID
callback_indexes << i
closure_index = arg.closure
closure_indexes << closure_index if closure_index != -1
destroy_index = arg.destroy
destroy_indexes << destroy_index if destroy_index != -1
end
end
args.find_all.with_index do |arg, i|
case arg.direction
when Direction::IN, Direction::INOUT
if array_length_indexes.include?(i)
false
elsif callback_indexes.include?(i)
false
elsif closure_indexes.include?(i)
false
elsif destroy_indexes.include?(i)
false
else
true
end
else
false
end
end
end
def required_in_args
in_args.reject do |arg|
arg.may_be_null?
end
end
def n_in_args
in_args.size
end
def n_required_in_args
required_in_args.size
end
def require_callback?
args.any? do |arg|
arg.direction == Direction::IN and arg.scope != ScopeType::INVALID
end
end
def out_args
args.find_all do |arg|
case arg.direction
when Direction::OUT, Direction::INOUT
true
else
false
end
end
end
def n_out_args
out_args.size
end
end
end
|