Class: GirFFI::Builders::FunctionBuilder
Overview
Implements the creation of a Ruby function definition out of a GIR IFunctionInfo.
Instance Method Summary
collapse
#invocation, #method_arguments, #method_definition, #preparation
Constructor Details
Returns a new instance of FunctionBuilder.
11
12
13
|
# File 'lib/gir_ffi/builders/function_builder.rb', line 11
def initialize(info)
super(info, ReturnValueBuilder)
end
|
Instance Method Details
#function_call_arguments ⇒ Object
31
32
33
34
35
|
# File 'lib/gir_ffi/builders/function_builder.rb', line 31
def function_call_arguments
ca = argument_builder_collection.call_argument_names.dup
ca.unshift receiver_call_argument if @info.method?
ca
end
|
#method_name ⇒ Object
15
16
17
|
# File 'lib/gir_ffi/builders/function_builder.rb', line 15
def method_name
@info.safe_name
end
|
#result ⇒ Object
19
20
21
22
23
24
25
|
# File 'lib/gir_ffi/builders/function_builder.rb', line 19
def result
if argument_builder_collection.has_return_values?
["return #{argument_builder_collection.return_value_names.join(", ")}"]
else
[]
end
end
|
#singleton_method? ⇒ Boolean
27
28
29
|
# File 'lib/gir_ffi/builders/function_builder.rb', line 27
def singleton_method?
!@info.method?
end
|