inline.rb

Path: lib/inline.rb
Last Update: Mon Oct 13 06:40:50 +0000 2008

Ruby Inline is a framework for writing ruby extensions in foreign languages.

SYNOPSIS

  require 'inline'
  class MyClass
    inline do |builder|
      builder.include "<math.h>"
      builder.c %q{
        long factorial(int max) {
          int i=max, result=1;
          while (i >= 2) { result *= i--; }
          return result;
        }
      }
    end
  end

DESCRIPTION

Inline allows you to write foreign code within your ruby code. It automatically determines if the code in question has changed and builds it only when necessary. The extensions are then automatically loaded into the class/module that defines it.

Using the package_inline tool Inline now allows you to package up your inlined object code for distribution to systems without a compiler (read: windows)!

You can even write extra builders that will allow you to write inlined code in any language. Use Inline::C as a template and look at Module#inline for the required API.

Required files

rbconfig   digest/md5   fileutils  

[Validate]