Class: GirFFI::Builders::RubyToCConvertor

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

Instance Method Summary collapse

Constructor Details

#initialize(type_info, argument_name) ⇒ RubyToCConvertor



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

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

Instance Method Details

#conversionObject



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

def conversion
  args = conversion_arguments @argument_name
  "#{@type_info.argument_class_name}.from(#{args})"
end

#conversion_arguments(name) ⇒ Object



12
13
14
# File 'lib/gir_ffi/builders/ruby_to_c_convertor.rb', line 12

def conversion_arguments name
  @type_info.extra_conversion_arguments.map(&:inspect).push(name).join(", ")
end