Class: GObjectIntrospection::CallableInfo

Inherits:
Object
  • Object
show all
Extended by:
CollectionReader
Defined in:
lib/gobject-introspection/callable-info.rb

Instance Method Summary collapse

Methods included from CollectionReader

collection_reader

Instance Method Details

#in_argsObject



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
# File 'lib/gobject-introspection/callable-info.rb', line 25

def in_args
  callback_indexes = []
  closure_indexes = []
  destroy_indexes = []
  args.each_with_index do |arg, i|
    next if 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

  args.find_all.with_index do |arg, i|
    case arg.direction
    when Direction::IN, Direction::INOUT
      if 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_argsObject



62
63
64
# File 'lib/gobject-introspection/callable-info.rb', line 62

def n_in_args
  in_args.size
end

#n_out_argsObject



87
88
89
# File 'lib/gobject-introspection/callable-info.rb', line 87

def n_out_args
  out_args.size
end

#n_required_in_argsObject



66
67
68
# File 'lib/gobject-introspection/callable-info.rb', line 66

def n_required_in_args
  required_in_args.size
end

#out_argsObject



76
77
78
79
80
81
82
83
84
85
# File 'lib/gobject-introspection/callable-info.rb', line 76

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

Returns:

  • (Boolean)


70
71
72
73
74
# File 'lib/gobject-introspection/callable-info.rb', line 70

def require_callback?
  args.any? do |arg|
    arg.direction == Direction::IN and arg.scope != ScopeType::INVALID
  end
end

#required_in_argsObject



56
57
58
59
60
# File 'lib/gobject-introspection/callable-info.rb', line 56

def required_in_args
  in_args.reject do |arg|
    arg.may_be_null?
  end
end