Class: GirFFI::Builders::CToRubyConvertor
- Inherits:
-
Object
- Object
- GirFFI::Builders::CToRubyConvertor
- Defined in:
- lib/gir_ffi/builders/c_to_ruby_convertor.rb
Overview
Builder that generates code to convert values from C to Ruby. Used by argument builders.
Instance Method Summary collapse
- #conversion ⇒ Object
-
#initialize(type_info, argument_name, length_arg) ⇒ CToRubyConvertor
constructor
A new instance of CToRubyConvertor.
Constructor Details
#initialize(type_info, argument_name, length_arg) ⇒ CToRubyConvertor
Returns a new instance of CToRubyConvertor.
4 5 6 7 8 |
# File 'lib/gir_ffi/builders/c_to_ruby_convertor.rb', line 4 def initialize type_info, argument_name, length_arg @type_info = type_info @argument_name = argument_name @length_arg = length_arg end |
Instance Method Details
#conversion ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/gir_ffi/builders/c_to_ruby_convertor.rb', line 10 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 |