Sha256: acae671b899bbd05ea6c44bbcb5d83fcc02cb48d4bec1e8596f887811c830490

Contents?: true

Size: 1.99 KB

Versions: 28

Compression:

Stored size: 1.99 KB

Contents

/* -*- coding: utf-8; 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"

VALUE rb_cGrnRecordExpressionBuilder;
VALUE rb_cGrnColumnExpressionBuilder;

VALUE
rb_grn_record_expression_builder_new (VALUE table, VALUE name)
{
    return rb_funcall(rb_cGrnRecordExpressionBuilder,
		      rb_intern("new"), 2, table, name);
}

VALUE
rb_grn_column_expression_builder_new (VALUE column, VALUE name, VALUE query)
{
    return rb_funcall(rb_cGrnColumnExpressionBuilder,
		      rb_intern("new"), 3, column, name, query);
}

static VALUE
build (VALUE self)
{
    return rb_funcall(self, rb_intern("build"), 0);
}

static VALUE
build_block (VALUE self)
{
    return rb_funcall(rb_block_proc(), rb_intern("call"), 1, self);
}

VALUE
rb_grn_record_expression_builder_build (VALUE self)
{
    if (rb_block_given_p())
	return rb_iterate(build, self, build_block, self);
    else
	return build(self);
}

VALUE
rb_grn_column_expression_builder_build (VALUE self)
{
    if (rb_block_given_p())
	return rb_iterate(build, self, build_block, self);
    else
	return build(self);
}

void
rb_grn_init_expression_builder (VALUE mGrn)
{
    rb_cGrnRecordExpressionBuilder =
        rb_const_get(mGrn, rb_intern("RecordExpressionBuilder"));
    rb_cGrnColumnExpressionBuilder =
        rb_const_get(mGrn, rb_intern("ColumnExpressionBuilder"));
}

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
rroonga-2.1.3-x86-mingw32 ext/groonga/rb-grn-expression-builder.c
rroonga-2.1.3 ext/groonga/rb-grn-expression-builder.c
rroonga-2.1.2-x86-mingw32 ext/groonga/rb-grn-expression-builder.c
rroonga-2.1.2 ext/groonga/rb-grn-expression-builder.c
rroonga-2.1.1-x86-mingw32 ext/groonga/rb-grn-expression-builder.c
rroonga-2.1.1 ext/groonga/rb-grn-expression-builder.c
rroonga-2.1.0-x86-mingw32 ext/groonga/rb-grn-expression-builder.c
rroonga-2.1.0 ext/groonga/rb-grn-expression-builder.c
rroonga-2.0.8-x86-mingw32 ext/groonga/rb-grn-expression-builder.c
rroonga-2.0.8 ext/groonga/rb-grn-expression-builder.c
rroonga-2.0.7-x86-mingw32 ext/groonga/rb-grn-expression-builder.c
rroonga-2.0.7 ext/groonga/rb-grn-expression-builder.c
rroonga-2.0.6 ext/groonga/rb-grn-expression-builder.c
rroonga-2.0.5 ext/groonga/rb-grn-expression-builder.c
rroonga-2.0.4-x86-mingw32 ext/groonga/rb-grn-expression-builder.c
rroonga-2.0.4 ext/groonga/rb-grn-expression-builder.c
rroonga-2.0.3-x86-mingw32 ext/groonga/rb-grn-expression-builder.c
rroonga-2.0.3 ext/groonga/rb-grn-expression-builder.c
rroonga-2.0.2 ext/groonga/rb-grn-expression-builder.c
rroonga-2.0.2-x86-mingw32 ext/groonga/rb-grn-expression-builder.c