#50 - documentation using RDoc
authorFedor Yudanov <fedwiz@academ.org>
Wed, 17 Apr 2013 11:31:27 +0000 (18:31 +0700)
committerFedor Yudanov <fedwiz@academ.org>
Wed, 17 Apr 2013 11:31:27 +0000 (18:31 +0700)
rbejdb/src/rbbson.c
rbejdb/src/rbejdb.c

index 9909790..1b3a961 100644 (file)
@@ -1,9 +1,22 @@
+/**************************************************************************************************
+ *  Ruby BSON API for EJDB database library http://ejdb.org
+ *  Copyright (C) 2012-2013 Softmotions Ltd <info@softmotions.com>
+ *
+ *  This file is part of EJDB.
+ *  EJDB is free software; you can redistribute it and/or modify it under the terms of
+ *  the GNU Lesser General Public License as published by the Free Software Foundation; either
+ *  version 2.1 of the License or any later version.  EJDB is distributed in the hope
+ *  that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ *  License for more details.
+ *  You should have received a copy of the GNU Lesser General Public License along with EJDB;
+ *  if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ *  Boston, MA 02111-1307 USA.
+ *************************************************************************************************/
 #include "rbbson.h"
 
 #include <ruby.h>
-#include <math.h>
 #include <string.h>
-#include <tcejdb/ejdb.h>
 
 #define BSON_CONTEXT_RUBY_CLASS "EJDB_BSON_CONTEXT"
 #define BSON_RUBY_CLASS "EJDB_BSON"
index bf8ba58..2dec8ef 100644 (file)
@@ -1212,7 +1212,7 @@ void EJDB_results_each(VALUE self) {
  * call-seq:
  *   results.count -> Number
  *
- * Returns total number of query result objects
+ * Returns total number of query result objects.
  */
 VALUE EJDB_results_count(VALUE self) {
     RBEJDB_RESULTS* rbresults;
@@ -1240,11 +1240,19 @@ VALUE EJDB_results_log(VALUE self) {
     return rbresults->log ? rb_str_new2(TCXSTRPTR(rbresults->log)) : Qnil;
 }
 
-void EJDB_results_close(VALUE self) {
+/*
+ * call-seq:
+ *   results.close -> nil
+ *
+ * Closes query results and immediately frees memory taken for results.
+ * Calling this method invalidates results container and any further access attempts will cause +RuntimeError+.
+ */
+VALUE EJDB_results_close(VALUE self) {
     RBEJDB_RESULTS* rbresults;
     Data_Get_Struct(self, RBEJDB_RESULTS, rbresults);
 
     close_ejdb_results_internal(rbresults);
+    return Qnil;
 }
 
 /*
@@ -1351,6 +1359,8 @@ Init_rbejdb() {
     rb_define_private_method(ejdbBinaryClass, "initialize", RUBY_METHOD_FUNC(EJDB_binary_init), 1);
     rb_define_method(ejdbBinaryClass, "each", RUBY_METHOD_FUNC(EJDB_binary_each), 0);
 
-    /* :nodoc: */
+    /*
+     * Internal EJDB class. :nodoc:
+     */
     ejdbQueryClass = rb_define_class("EJDBQuery", rb_cObject);
 }
\ No newline at end of file