Class: GirFFI::Builders::CToRubyConvertor

Inherits:
Object
  • Object
show all
Defined in:
lib/gir_ffi/builders/c_to_ruby_convertor.rb

Instance Method Summary collapse

Constructor Details

#initialize(type_info, argument_name, length_arg) ⇒ CToRubyConvertor

Returns a new instance of CToRubyConvertor.



2
3
4
5
6
# File 'lib/gir_ffi/builders/c_to_ruby_convertor.rb', line 2

def initialize type_info, argument_name, length_arg
  @type_info = type_info
  @argument_name = argument_name
  @length_arg = length_arg
end

Instance Method Details

#conversionObject



8
9
10
11
12
13
14
15
# File 'lib/gir_ffi/builders/c_to_ruby_convertor.rb', line 8

def conversion
  case @type_info.flattened_tag
  when :utf8, :filename
    "#{@argument_name}.to_utf8"
  else
    "#{@type_info.argument_class_name}.wrap(#{conversion_arguments})"
  end
end