Sha256: f15912025ecff2a2f9559537d62299a4772999694bfaec85694cccdb8f6ba893

Contents?: true

Size: 1.72 KB

Versions: 25

Compression:

Stored size: 1.72 KB

Contents

/* -*- c-file-style: "ruby" -*- */
/*
  Copyright (C) 2009  Kouhei Sutou <kou@clear-code.com>

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License version 2.1 as published by the Free Software Foundation.

  This library 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 this library; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

#include "rb-grn.h"

#define SELF(object) (RVAL2GRNPROCEDURE(object))

VALUE rb_cGrnProcedure;

grn_obj *
rb_grn_procedure_from_ruby_object (VALUE object)
{
    if (!RVAL2CBOOL(rb_obj_is_kind_of(object, rb_cGrnProcedure))) {
	rb_raise(rb_eTypeError, "not a groonga procedure");
    }

    return RVAL2GRNOBJECT(object, NULL);
}

VALUE
rb_grn_procedure_to_ruby_object (grn_ctx *context, grn_obj *procedure,
				 rb_grn_boolean owner)
{
    return GRNOBJECT2RVAL(rb_cGrnProcedure, context, procedure, owner);
}

void
rb_grn_init_procedure (VALUE mGrn)
{
    rb_cGrnProcedure = rb_define_class_under(mGrn, "Procedure", rb_cGrnObject);

    rb_define_const(rb_cGrnProcedure, "DELIMIT", INT2NUM(GRN_DB_DELIMIT));
    rb_define_const(rb_cGrnProcedure, "UNIGRAM", INT2NUM(GRN_DB_UNIGRAM));
    rb_define_const(rb_cGrnProcedure, "BIGRAM", INT2NUM(GRN_DB_BIGRAM));
    rb_define_const(rb_cGrnProcedure, "TRIGRAM", INT2NUM(GRN_DB_TRIGRAM));
    rb_define_const(rb_cGrnProcedure, "MECAB", INT2NUM(GRN_DB_MECAB));
}

Version data entries

25 entries across 25 versions & 2 rubygems

Version Path
rroonga-1.0.5 ext/groonga/rb-grn-procedure.c
rroonga-1.0.4 ext/groonga/rb-grn-procedure.c
rroonga-1.0.3 ext/groonga/rb-grn-procedure.c
rroonga-1.0.2 ext/groonga/rb-grn-procedure.c
rroonga-1.0.1-x86-mingw32 ext/groonga/rb-grn-procedure.c
rroonga-1.0.1 ext/groonga/rb-grn-procedure.c
rroonga-1.0.0 ext/groonga/rb-grn-procedure.c
rroonga-0.9.5-x86-mingw32 ext/groonga/rb-grn-procedure.c
rroonga-0.9.5 ext/groonga/rb-grn-procedure.c
rroonga-0.9.4 ext/groonga/rb-grn-procedure.c
rroonga-0.9.4-x86-mingw32 ext/groonga/rb-grn-procedure.c
rroonga-0.9.3-x86-mingw32 ext/groonga/rb-grn-procedure.c
rroonga-0.9.3 ext/groonga/rb-grn-procedure.c
rroonga-0.9.2-x86-mingw32 ext/groonga/rb-grn-procedure.c
rroonga-0.9.2-mswin32 ext/rb-grn-procedure.c
rroonga-0.9.2 ext/groonga/rb-grn-procedure.c
groonga-0.9.1 ext/rb-grn-procedure.c
groonga-0.9.0 ext/rb-grn-procedure.c
groonga-0.0.7 ext/rb-grn-procedure.c
groonga-0.0.3 ext/rb-grn-procedure.c