Class: Groonga::GreaterEqualOperator

Inherits:
Operator
  • Object
show all
Defined in:
ext/groonga/rb-grn-greater-equal-operator.c

Constant Summary

Constants inherited from Operator

Operator::ADJUST, Operator::AND, Operator::AND_ASSIGN, Operator::AND_NOT, Operator::ASSIGN, Operator::BITWISE_AND, Operator::BITWISE_NOT, Operator::BITWISE_OR, Operator::BITWISE_XOR, Operator::BUT, Operator::CALL, Operator::CJUMP, Operator::COMMA, Operator::DECREMENT, Operator::DECREMENT_POST, Operator::DELETE, Operator::EQUAL, Operator::EXACT, Operator::EXPRESSION_GET_VARIABLE, Operator::FUZZY, Operator::GEO_DISTANCE1, Operator::GEO_DISTANCE2, Operator::GEO_DISTANCE3, Operator::GEO_DISTANCE4, Operator::GEO_WITHINP5, Operator::GEO_WITHINP6, Operator::GEO_WITHINP8, Operator::GET_REFERENCE, Operator::GET_VALUE, Operator::GREATER, Operator::GREATER_EQUAL, Operator::IN, Operator::INCREMENT, Operator::INCREMENT_POST, Operator::INTERN, Operator::JSON_PUT, Operator::JUMP, Operator::LESS, Operator::LESS_EQUAL, Operator::LONGEST_COMMON_PREFIX, Operator::MATCH, Operator::MINUS, Operator::MINUS_ASSIGN, Operator::MODULO, Operator::MODULO_ASSIGN, Operator::NEAR, Operator::NEAR2, Operator::NOT, Operator::NOT_EQUAL, Operator::NO_OPERATION, Operator::OBJECT_SEARCH, Operator::OR, Operator::OR_ASSIGN, Operator::PARTIAL, Operator::PLUS, Operator::PLUS_ASSIGN, Operator::POP, Operator::PREFIX, Operator::PUSH, Operator::REGEXP, Operator::SHIFTL, Operator::SHIFTL_ASSIGN, Operator::SHIFTR, Operator::SHIFTRR, Operator::SHIFTRR_ASSIGN, Operator::SHIRTR_ASSIGN, Operator::SIMILAR, Operator::SLASH, Operator::SLASH_ASSIGN, Operator::STAR, Operator::STAR_ASSIGN, Operator::SUFFIX, Operator::TABLE_CREATE, Operator::TABLE_GROUP, Operator::TABLE_SELECT, Operator::TABLE_SORT, Operator::TERM_EXTRACT, Operator::UNSPLIT, Operator::XOR_ASSIGN

Instance Method Summary collapse

Methods inherited from Operator

#initialize, #to_i, #to_s

Constructor Details

This class inherits a constructor from Groonga::Operator

Instance Method Details

#exec(x, y, options = {}) ⇒ Boolean

Executes a greater-or-equal operation.

Examples:

Executes greater-or-equal operations with the default context

Groonga::Operator::GREATER_EQUAL.exec(1, 1) # => true
Groonga::Operator::GREATER_EQUAL.exec(2, 1) # => true
Groonga::Operator::GREATER_EQUAL.exec(1, 2) # => false

Executes greater-or-equal operations with the specified context

context = Groonga::Context.new
Groonga::Operator::GREATER_EQUAL.exec(1, 1,
                                      :context => context) # => true
Groonga::Operator::GREATER_EQUAL.exec(2, 1,
                                      :context => context) # => true
Groonga::Operator::GREATER_EQUAL.exec(1, 2,
                                      :context => context) # => false

Returns true if x is greater than or equal toy, false otherwise.

Parameters:

  • x (::Object)

    The left hand side value.

  • y (::Object)

    The right hand side value.

  • options (::Hash) (defaults to: {})

    The options.

Options Hash (options):

  • (Groonga::Context.default) (Groonga::Context)

    The context to executes the operation.

Returns:

  • (Boolean)

    true if x is greater than or equal toy, false otherwise.



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'ext/groonga/rb-grn-greater-equal-operator.c', line 49

static VALUE
rb_grn_greater_equal_operator_exec (int argc, VALUE *argv, VALUE self)
{
    grn_bool greater_equal;
    VALUE rb_x;
    VALUE rb_y;
    VALUE rb_options;
    VALUE rb_context;
    grn_ctx *context;
    grn_obj x;
    grn_obj y;

    rb_scan_args(argc, argv, "21", &rb_x, &rb_y, &rb_options);

    rb_grn_scan_options(rb_options,
                        "context", &rb_context,
                        NULL);
    context = rb_grn_context_ensure(&rb_context);

    GRN_VOID_INIT(&x);
    GRN_VOID_INIT(&y);
    RVAL2GRNBULK(rb_x, context, &x);
    RVAL2GRNBULK(rb_y, context, &y);
    greater_equal = grn_operator_exec_greater_equal(context, &x, &y);
    GRN_OBJ_FIN(context, &x);
    GRN_OBJ_FIN(context, &y);

    return CBOOL2RVAL(greater_equal);
}