File: ruby_eval.rst

package info (click to toggle)
groonga 15.0.4%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 163,080 kB
  • sloc: ansic: 770,564; cpp: 48,925; ruby: 40,447; javascript: 10,250; yacc: 7,045; sh: 5,602; python: 2,821; makefile: 1,672
file content (69 lines) | stat: -rw-r--r-- 1,393 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
.. -*- rst -*-

.. groonga-command
.. database: commands_ruby_eval

``ruby_eval``
=============

Summary
-------

``ruby_eval`` command evaluates Ruby script and returns the result.

Syntax
------

This command takes only one required parameter::

  ruby_eval script

Usage
-----

You can execute any scripts which mruby supports by calling ``ruby_eval``.

Here is an example that just calculate ``1 + 2`` as Ruby script.

.. groonga-command
.. include:: ../../example/reference/commands/ruby_eval/calc.log
.. plugin_register ruby/eval
.. ruby_eval "1 + 2"

Register ``ruby/eval`` plugin to use ``ruby_eval`` command in advance.

Note that ``ruby_eval`` is implemented as an experimental plugin,
and the specification may be changed in the future.

Parameters
----------

This section describes all parameters.

``script``
""""""""""

Specifies the Ruby script which you want to evaluate.

Return value
------------

``ruby_eval`` returns the evaluated result with metadata such as
exception information (Including metadata isn't implemented yet)::

  [HEADER, {"value": EVALUATED_VALUE}]

``HEADER``

  See :doc:`/reference/command/output_format` about ``HEADER``.

``EVALUATED_VALUE``

  ``EVALUATED_VALUE`` is the evaluated value of ``ruby_script``.

  ``ruby_eval`` supports only a number for evaluated value for now.
  Supported types will be increased in the future.

See also
--------