[Ruby/C++] Say hello to Rarity, C++ wrapper for the libruby!

Greetings everypony !

Today I'm presenting my latest work, Rarity, a C++ wrapper for the
libruby.
Its goal is to bring the neatness of the libruby with all the
crunchiness of C++.
You can use it to extend your Ruby application with C++, or the other
way round.

Enough chit-chat, let me show you how Rarity can make your life easier :
I present you a typical piece of Rarity code :

#include <rarity.hpp>
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main(void)
{
  string str("hello there !");
  Rarity::Instance rubyStr(Rarity::RValue(str));
  // Rarity::RValue converts a C type to a VALUE

  if (rubyStr.extends("String")) // This is true, of course
  {
    vector<string> matched;

    rubyStr = rubyStr.Call("capitalize");
    matched = rubyStr.Call("match", 1, Rarity::RValue("(.)\l"));
    cout << matched[0] << endl; // displays 'll'
  }
  return (0);
}

As the above code shows you, using Rartiy::Instance, you can interact
with Ruby instances in the most easy way : you can directly apply
methods on them like any other VALUE, working with its Class, or casting
it to a C-type. Rarity will take care of the conversion.

The library comes with a Doxygen documentation, and its Wiki on Google
Code will provide you with 3 tutorials explaining pretty much everything
there is to know about Rarity.

I hope you'll like it !
Right now I'm looking forward for some feedback, and maybe some advice
to make Rarity even better, and even easier !

Rarity's web page : http://code.google.com/p/rarity/

Thanks for reading !

···

--
Posted via http://www.ruby-forum.com/.