Sha256: 9d23d89047163eb30324030585fd09ef29b3144769f6cddb20f652a6d194945c

Contents?: true

Size: 577 Bytes

Versions: 10

Compression:

Stored size: 577 Bytes

Contents

module GirFFI
  module Builders
    # Builder that generates code to convert values from Ruby to C. Used by
    # argument builders.
    class 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
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
gir_ffi-0.9.2 lib/gir_ffi/builders/ruby_to_c_convertor.rb
gir_ffi-0.9.1 lib/gir_ffi/builders/ruby_to_c_convertor.rb
gir_ffi-0.9.0 lib/gir_ffi/builders/ruby_to_c_convertor.rb
gir_ffi-0.8.6 lib/gir_ffi/builders/ruby_to_c_convertor.rb
gir_ffi-0.8.5 lib/gir_ffi/builders/ruby_to_c_convertor.rb
gir_ffi-0.8.4 lib/gir_ffi/builders/ruby_to_c_convertor.rb
gir_ffi-0.8.3 lib/gir_ffi/builders/ruby_to_c_convertor.rb
gir_ffi-0.8.2 lib/gir_ffi/builders/ruby_to_c_convertor.rb
gir_ffi-0.8.1 lib/gir_ffi/builders/ruby_to_c_convertor.rb
gir_ffi-0.8.0 lib/gir_ffi/builders/ruby_to_c_convertor.rb