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

#descriptionObject



68
69
70
# File 'lib/gobject-introspection/callable-info.rb', line 68

def description
  signature
end

#have_return_value?Boolean

Returns:

  • (Boolean)


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

def have_return_value?
  return true if return_type.tag != TypeTag::VOID
  return true if return_type.pointer?
  not n_out_args.zero?
end

#in_argsObject



25
26
27
# File 'lib/gobject-introspection/callable-info.rb', line 25

def in_args
  @in_args ||= compute_in_args
end

#inspectObject



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

def inspect
  super.gsub(/>\z/) do
    " signature=<#{signature}>" +
      " name=#{name.inspect}" +
      " arguments=#{args.inspect}" +
      " return_type=#{return_type.inspect}" +
      " may_return_type_null=#{may_return_null?.inspect}>"
  end
end

#n_in_argsObject



35
36
37
# File 'lib/gobject-introspection/callable-info.rb', line 35

def n_in_args
  in_args.size
end

#n_out_argsObject



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

def n_out_args
  out_args.size
end

#n_required_in_argsObject



39
40
41
# File 'lib/gobject-introspection/callable-info.rb', line 39

def n_required_in_args
  required_in_args.size
end

#out_argsObject



47
48
49
50
51
52
53
54
55
56
# File 'lib/gobject-introspection/callable-info.rb', line 47

def out_args
  @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)


43
44
45
# File 'lib/gobject-introspection/callable-info.rb', line 43

def require_callback?
  (@require_callback ||= compute_require_callback) == :required
end

#required_in_argsObject



29
30
31
32
33
# File 'lib/gobject-introspection/callable-info.rb', line 29

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

#signatureObject



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

def signature
  argument_signatures = args.collect(&:signature).join(", ")
  "#{name}(#{argument_signatures}): #{return_type.description}"
end