<commit_before>// Include the Ruby headers and goodies
#include "ruby.h"
#include <stdlib.h>

typedef struct struct_rtst_ctst {
  char* text;
} rtst_ctst;

static VALUE rtst_new(VALUE self) {
  rtst_ctst *ctst;

  VALUE obj = Data_Make_Struct(
    self, // target object
    rtst_ctst, // structure type
    NULL, // mark function
    free, // free function
    ctst  // structure instance
  );

  ctst->text = "Hello, world";

  return obj;
}

static VALUE rtst_to_s(VALUE self) {
  rtst_ctst *ctst;

  Data_Get_Struct(
    self,
    rtst_ctst,
    ctst
  );
  
  return rb_str_new2(ctst->text);
}

// The initialization method for this module
void Init_rtst() {
	VALUE RTST = rb_define_class("RTST",rb_cObject);
	rb_define_singleton_method(RTST, "new", rtst_new, 0);
	rb_define_method(RTST, "to_s", rtst_to_s, 0);
}
<commit_msg>Better skeleton for bindings. Now I'll have to fight to handle includes and linking with the ctst sources.<commit_after>#include "ruby.h"
#include <stdlib.h>

typedef struct struct_rtst_ctst {
  char* text;
} rtst_ctst;

static VALUE rtst_new(VALUE self,VALUE string) {
  rtst_ctst *ctst = (rtst_ctst*)malloc(sizeof(rtst_ctst));

  VALUE obj = Data_Make_Struct(
    self, /* target object */
    rtst_ctst, /* structure type */
    NULL, /* mark function */
    free, /* free function */
    ctst  /* structure instance */
  );

  ctst->text = StringValuePtr(string);

  return obj;
}

static VALUE rtst_to_s(VALUE self) {
  rtst_ctst *ctst;

  Data_Get_Struct(
    self,
    rtst_ctst,
    ctst
  );
  
  return rb_str_new2(ctst->text);
}

/*
 * The initialization method for this module
 */ 
void Init_rtst() {
	VALUE RTST = rb_define_class("RTST",rb_cObject);
	rb_define_singleton_method(RTST, "new", rtst_new, 1);
	rb_define_method(RTST, "to_s", rtst_to_s, 0);
}

{'fraction_non_alphanumeric': 0.11797440178074568, 'fraction_numerical': 0.00333889816360601, 'mean_word_length': 3.67012987012987, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '72342', 'n_tokens_mistral': 714, 'n_tokens_neox': 678, 'n_words': 165}