0

I create an extension for Ruby in C and I am currently struggling with calling constructor on class I defined also in C.

Code for class definition is called before the class is being used. I am trying to get the class using

VALUE rb_cConfidenceInterval = rb_const_get( rb_cObject, rb_intern( "ConfidenceInterval" ) );
VALUE interval = rb_funcall(
        rb_cConfidenceInterval, rb_intern( "new" ), 2,
        rb_float_new( lower_bound ),
        rb_float_new( upper_bound )
);

but it fails while running tests on uninitialized constant ConfidenceInterval. NormalDistribution::ConfidenceInterval did not help either.

To provide some context, the code is available on github

Any idea how to get the class?

I was trying to find something like require, but it does not seem to be anything like it.

dom
  • 414
  • 3
  • 12

1 Answers1

0
VALUE rb_cConfidenceInterval = rb_path2class( "NormalDistribution::ConfidenceInterval" );

based on examples

dom
  • 414
  • 3
  • 12