I'm trying to do something like this but I'm having trouble understanding how to use Ruby internals in my C code.
static VALUE func_get_date_object(VALUE self, VALUE vdate){
VALUE rb_date;
VALUE date;
rb_date = rb_funcall(rb_intern("Date"), rb_intern("new"), 0);;
date = rb_funcall(rb_date, rb_intern("parse"), 0);
return date;
}
What I want to do is pass in the vdate as a string like you would for Date.parse('yyyy-mm-dd')
But first I think that I need to know how to create or instantiate a new Date class object in C for Ruby. How may I do this please?
I have a test written for that code that does this.
def test_date
assert_equal('', @t.date(@t_date_str))
end
Output is
NoMethodError: undefined method `new' for 18709:Fixnum