Wednesday, April 1, 2009

QtRuby 4.0.1

QtRuby 4.0.1 is released, this one is able to convert from Ruby class/module to Qt class. Sample code is below:
#include <date/RDateTime>

int main(int argc, char *argv[])
{
    RDateTime current = RDateTime::now;
    fprintf(stdout, current.toS());
    return 0;
}

First, Ruby's require 'date' is corresponding to #include <date/. Second, Ruby class/module DateTime is corresponding to RDateTime>, which is converted with prefix 'R'. Last, Ruby's snake_case method name(ex. to_s) is converted to camelCase method name(ex. toS()).

No comments:

Post a Comment