Class: GObjectIntrospection::CallableInfo
- Inherits:
-
Object
- Object
- GObjectIntrospection::CallableInfo
- Extended by:
- CollectionReader
- Defined in:
- lib/gobject-introspection/callable-info.rb
Instance Method Summary collapse
- #in_args ⇒ Object
- #n_in_args ⇒ Object
- #n_out_args ⇒ Object
- #n_required_in_args ⇒ Object
- #out_args ⇒ Object
- #require_callback? ⇒ Boolean
- #required_in_args ⇒ Object
Methods included from CollectionReader
Instance Method Details
#in_args ⇒ Object
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 |
# File 'lib/gobject-introspection/callable-info.rb', line 25 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 |
#n_in_args ⇒ Object
71 72 73 |
# File 'lib/gobject-introspection/callable-info.rb', line 71 def n_in_args in_args.size end |
#n_out_args ⇒ Object
96 97 98 |
# File 'lib/gobject-introspection/callable-info.rb', line 96 def n_out_args out_args.size end |
#n_required_in_args ⇒ Object
75 76 77 |
# File 'lib/gobject-introspection/callable-info.rb', line 75 def n_required_in_args required_in_args.size end |
#out_args ⇒ Object
85 86 87 88 89 90 91 92 93 94 |
# File 'lib/gobject-introspection/callable-info.rb', line 85 def out_args args.find_all do |arg| case arg.direction when Direction::OUT, Direction::INOUT true else false end end end |
#require_callback? ⇒ Boolean
79 80 81 82 83 |
# File 'lib/gobject-introspection/callable-info.rb', line 79 def require_callback? args.any? do |arg| arg.direction == Direction::IN and arg.scope != ScopeType::INVALID end end |
#required_in_args ⇒ Object
65 66 67 68 69 |
# File 'lib/gobject-introspection/callable-info.rb', line 65 def required_in_args in_args.reject do |arg| arg.may_be_null? end end |