diff --git a/Gemfile b/Gemfile index 7a29947..648b7a1 100644 --- a/Gemfile +++ b/Gemfile @@ -4,4 +4,4 @@ gem "hoe" gem "hoe-gemspec" gem "rspec" gem "rake-compiler" -gem "yard", "0.7.5" \ No newline at end of file +gem "yard" \ No newline at end of file diff --git a/ext/opencv/cvcontourtree.cpp b/ext/opencv/cvcontourtree.cpp index 9bb896d..bb8b833 100644 --- a/ext/opencv/cvcontourtree.cpp +++ b/ext/opencv/cvcontourtree.cpp @@ -12,6 +12,7 @@ * Document-class: OpenCV::CvContourTree * * Contour tree + * * @see CvContour#create_tree */ __NAMESPACE_BEGIN_OPENCV @@ -25,26 +26,6 @@ rb_class() return rb_klass; } -void -define_ruby_class() -{ - if (rb_klass) - return; - /* - * opencv = rb_define_module("OpenCV"); - * cvseq = rb_define_class_under(opencv, "CvSeq"); - * - * note: this comment is used by rdoc. - */ - VALUE opencv = rb_module_opencv(); - VALUE cvseq = cCvSeq::rb_class(); - - rb_klass = rb_define_class_under(opencv, "CvContourTree", cvseq); - rb_define_method(rb_klass, "p1", RUBY_METHOD_FUNC(rb_p1), 0); - rb_define_method(rb_klass, "p2", RUBY_METHOD_FUNC(rb_p2), 0); - rb_define_method(rb_klass, "contour", RUBY_METHOD_FUNC(rb_contour), 1); -} - /* * Returns the first point of the binary tree root segment * @overload p1 @@ -92,5 +73,24 @@ rb_contour(VALUE self, VALUE criteria) return cCvSeq::new_sequence(cCvContour::rb_class(), contour, cCvPoint::rb_class(), storage); } +void +init_ruby_class() +{ +#if 0 + // For documentation using YARD + VALUE opencv = rb_define_module("OpenCV"); + VALUE cvseq = rb_define_class_under(opencv, "CvSeq"); +#endif + if (rb_klass) + return; + VALUE opencv = rb_module_opencv(); + VALUE cvseq = cCvSeq::rb_class(); + + rb_klass = rb_define_class_under(opencv, "CvContourTree", cvseq); + rb_define_method(rb_klass, "p1", RUBY_METHOD_FUNC(rb_p1), 0); + rb_define_method(rb_klass, "p2", RUBY_METHOD_FUNC(rb_p2), 0); + rb_define_method(rb_klass, "contour", RUBY_METHOD_FUNC(rb_contour), 1); +} + __NAMESPACE_END_CVCONTOURTREE __NAMESPACE_END_OPENCV diff --git a/ext/opencv/cvcontourtree.h b/ext/opencv/cvcontourtree.h index 685500f..570fcde 100644 --- a/ext/opencv/cvcontourtree.h +++ b/ext/opencv/cvcontourtree.h @@ -19,7 +19,7 @@ __NAMESPACE_BEGIN_CVCONTOURTREE VALUE rb_class(); -void define_ruby_class(); +void init_ruby_class(); VALUE rb_p1(VALUE self); VALUE rb_p2(VALUE self); diff --git a/ext/opencv/opencv.cpp b/ext/opencv/opencv.cpp index 3247a17..fb2a011 100644 --- a/ext/opencv/opencv.cpp +++ b/ext/opencv/opencv.cpp @@ -665,7 +665,7 @@ extern "C" { mOpenCV::mPointSet::define_ruby_module(); mOpenCV::cCvChain::define_ruby_class(); mOpenCV::cCvContour::define_ruby_class(); - mOpenCV::cCvContourTree::define_ruby_class(); + mOpenCV::cCvContourTree::init_ruby_class(); mOpenCV::cCvMat::define_ruby_class(); mOpenCV::cIplImage::define_ruby_class();