Class: GirFFI::Builders::FunctionBuilder
Overview
Implements the creation of a Ruby function definition out of a GIR IFunctionInfo.
Instance Method Summary
collapse
#argument_builder_collection, #argument_builders, #error_argument, #invocation, #method_arguments, #method_definition, #preparation, #receiver_builder, #return_value_builder, #return_value_info, #template, #variable_generator
Constructor Details
Returns a new instance of FunctionBuilder.
10
11
12
|
# File 'lib/gir_ffi/builders/function_builder.rb', line 10
def initialize(info)
super(info, ReturnValueBuilder)
end
|
Instance Method Details
#function_call_arguments ⇒ Object
30
31
32
33
34
|
# File 'lib/gir_ffi/builders/function_builder.rb', line 30
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
14
15
16
|
# File 'lib/gir_ffi/builders/function_builder.rb', line 14
def method_name
@info.safe_name
end
|
#result ⇒ Object
18
19
20
21
22
23
24
|
# File 'lib/gir_ffi/builders/function_builder.rb', line 18
def result
if argument_builder_collection.has_return_values?
["return #{argument_builder_collection.return_value_names.join(', ')}"]
else
[]
end
end
|
#singleton_method? ⇒ Boolean
26
27
28
|
# File 'lib/gir_ffi/builders/function_builder.rb', line 26
def singleton_method?
!@info.method?
end
|