Class: Groonga::Variable

Inherits:
Object
  • Object
show all
Defined in:
ext/groonga/rb-grn-variable.c,
ext/groonga/rb-grn-variable.c

Overview

Expression で使われる変数。

Instance Method Summary collapse

Methods inherited from Object

#==, #[], #[]=, #accessor?, #append, #builtin?, #close, #closed?, #column?, #dirty?, #domain, #function_procedure?, #id, #index_column?, #inspect, #key_accessor?, #last_modified, #name, #path, #persistent?, #prepend, #procedure?, #range, #reference_column?, #remove, #scorer_procedure?, #selector_only_procedure?, #selector_procedure?, #table?, #temporary?, #touch, #unlink, #window_function_procedure?

Instance Method Details

#valueGroonga::Object

変数の値を返す。

Returns:



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'ext/groonga/rb-grn-variable.c', line 67

static VALUE
rb_grn_variable_get_value (VALUE self)
{
    grn_ctx *context = NULL;
    grn_obj *variable, *value;

    rb_grn_variable_deconstruct(SELF(self), &variable, &context,
                                NULL, NULL,
                                NULL, NULL);

    if (variable->header.type == GRN_PTR) {
        value = GRN_PTR_VALUE(variable);
    } else {
        value = variable;
    }

    return GRNOBJ2RVAL(Qnil, context, value, self);
}

#value=(value) ⇒ Object

変数の値を value に設定する。



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'ext/groonga/rb-grn-variable.c', line 91

static VALUE
rb_grn_variable_set_value (VALUE self, VALUE rb_value)
{
    grn_ctx *context = NULL;
    grn_obj *variable;

    rb_grn_variable_deconstruct(SELF(self), &variable, &context,
                                NULL, NULL,
                                NULL, NULL);
    if (variable->header.type == GRN_PTR) {
        grn_obj *value = NULL;
        RVAL2GRNOBJ(rb_value, context, &value);
        GRN_PTR_SET(context, variable, value);
    } else {
        RVAL2GRNOBJ(rb_value, context, &variable);
    }

    return Qnil;
}