[Groonga-commit] ranguba/rroonga at a9102f5 [master] Add Groonga::Object#window_function_procedure?

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Jun 6 16:35:08 JST 2016


Kouhei Sutou	2016-06-06 16:35:08 +0900 (Mon, 06 Jun 2016)

  New Revision: a9102f57928fcaa6fa38ca1274d3cfb1e5016bb7
  https://github.com/ranguba/rroonga/commit/a9102f57928fcaa6fa38ca1274d3cfb1e5016bb7

  Message:
    Add Groonga::Object#window_function_procedure?

  Modified files:
    ext/groonga/rb-grn-object.c
    test/test-procedure.rb

  Modified: ext/groonga/rb-grn-object.c (+29 -0)
===================================================================
--- ext/groonga/rb-grn-object.c    2016-06-06 16:28:33 +0900 (6ef3a33)
+++ ext/groonga/rb-grn-object.c    2016-06-06 16:35:08 +0900 (5daba09)
@@ -1679,6 +1679,33 @@ rb_grn_object_scorer_procedure_p (VALUE self)
 }
 
 /*
+ * Checks whether the object is windows function procedure or not.
+ *
+ * @overload window_function_procedure?
+ *   @return [Boolean] `true` if the object is window function procedure,
+ *     `false` otherwise.
+ *
+ * @since 6.0.4
+ */
+static VALUE
+rb_grn_object_window_function_procedure_p (VALUE self)
+{
+    grn_ctx *context;
+    grn_obj *object;
+    grn_bool window_function_procedure_p = GRN_FALSE;
+
+    rb_grn_object_deconstruct(SELF(self), &object, &context,
+                              NULL, NULL, NULL, NULL);
+
+    if (context && object) {
+        window_function_procedure_p =
+            grn_obj_is_window_function_proc(context, object);
+    }
+
+    return CBOOL2RVAL(window_function_procedure_p);
+}
+
+/*
  * Checks whether the object is accessor or not.
  *
  * @overload accessor?
@@ -1785,6 +1812,8 @@ rb_grn_init_object (VALUE mGrn)
                      rb_grn_object_selector_only_procedure_p, 0);
     rb_define_method(rb_cGrnObject, "scorer_procedure?",
                      rb_grn_object_scorer_procedure_p, 0);
+    rb_define_method(rb_cGrnObject, "window_function_procedure?",
+                     rb_grn_object_window_function_procedure_p, 0);
     rb_define_method(rb_cGrnObject, "accessor?",
                      rb_grn_object_accessor_p, 0);
     rb_define_method(rb_cGrnObject, "key_accessor?",

  Modified: test/test-procedure.rb (+6 -0)
===================================================================
--- test/test-procedure.rb    2016-06-06 16:28:33 +0900 (c05d8d2)
+++ test/test-procedure.rb    2016-06-06 16:35:08 +0900 (c114ff6)
@@ -52,6 +52,12 @@ class ProcedureTest < Test::Unit::TestCase
     end
   end
 
+  def test_window_function_procedure?
+    assert do
+      Groonga["record_number"].window_function_procedure?
+    end
+  end
+
   private
   def assert_equal_procedure(expected_name, id, options={})
     procedure = Groonga::Context.default[id]
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index