groonga - An open-source fulltext search engine and column store.

8.3.22. ruby_eval

8.3.22.1. Summary

ruby_eval command evaluates ruby script and returns the result.

8.3.22.2. Syntax

ruby_eval has one required parameter:

ruby_eval ruby_script

8.3.22.3. Usage

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

Here is an example that just calculate 1 + 2 by mruby plugin.

Execution example:

register ruby/eval
# [[0, 1337566253.89858, 0.000355720520019531], true]
ruby_eval "1 + 2"
# [[0, 1337566253.89858, 0.000355720520019531], {"value": 3}]

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.

8.3.22.4. Parameters

This section describes all parameters.

8.3.22.4.1. ruby_script

It specifies the ruby script which you want to evaluate.

8.3.22.5. Return value

ruby_eval returns the evaluated result which key is "value" as json format:

[[HEADER, EVALUATED]]

HEADER

See Output format about HEADER.

EVALUATED

EVALUATED consists of pair of key and value in forms of {key:value}.

Name Description
key reserved word 'value'.
value the value of evaluated script. It must be a number.

8.3.22.6. See also

Table Of Contents

Previous topic

8.3.21. register

Next topic

8.3.23. select

This Page