Sha256: cdc20a0e7203fa0cf6bdc70be76d16643448a8d0a3ee6cf72e2d19a3e662b483

Contents?: true

Size: 491 Bytes

Versions: 3

Compression:

Stored size: 491 Bytes

Contents

# Builder that generates code to convert values from Ruby to C. Used by
# argument builders.
class GirFFI::Builders::RubyToCConvertor
  def initialize type_info, argument_name
    @type_info = type_info
    @argument_name = argument_name
  end

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gir_ffi-0.7.7 lib/gir_ffi/builders/ruby_to_c_convertor.rb
gir_ffi-0.7.6 lib/gir_ffi/builders/ruby_to_c_convertor.rb
gir_ffi-0.7.5 lib/gir_ffi/builders/ruby_to_c_convertor.rb