Class: GirFFI::Builders::CallbackReturnValueBuilder

Inherits:
BaseArgumentBuilder show all
Defined in:
lib/gir_ffi/builders/callback_return_value_builder.rb

Constant Summary

Constants inherited from BaseArgumentBuilder

BaseArgumentBuilder::KEYWORDS

Instance Attribute Summary

Attributes inherited from BaseArgumentBuilder

#arginfo, #array_arg, #is_closure, #length_arg

Instance Method Summary collapse

Methods inherited from BaseArgumentBuilder

#argument_class_name, #array_length_idx, #callarg, #direction, #initialize, #name, #new_variable, #safe, #specialized_type_tag, #type_info

Constructor Details

This class inherits a constructor from GirFFI::Builders::BaseArgumentBuilder

Instance Method Details

#capture_variable_nameObject



11
12
13
14
15
# File 'lib/gir_ffi/builders/callback_return_value_builder.rb', line 11

def capture_variable_name
  if is_relevant?
    @capture_variable_name ||= new_variable
  end
end

#is_relevant?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/gir_ffi/builders/callback_return_value_builder.rb', line 7

def is_relevant?
  !is_void_return_value? && !arginfo.skip?
end

#post_conversionObject



31
32
33
34
35
36
37
# File 'lib/gir_ffi/builders/callback_return_value_builder.rb', line 31

def post_conversion
  if has_post_conversion?
    [ "#{post_converted_name} = #{post_convertor.conversion}" ]
  else
    []
  end
end

#post_converted_nameObject



17
18
19
20
21
22
23
# File 'lib/gir_ffi/builders/callback_return_value_builder.rb', line 17

def post_converted_name
  @post_converted_name ||= if has_post_conversion?
                             new_variable
                           else
                             capture_variable_name
                           end
end

#return_value_nameObject



25
26
27
28
29
# File 'lib/gir_ffi/builders/callback_return_value_builder.rb', line 25

def return_value_name
  if is_relevant?
    post_converted_name unless array_arg
  end
end