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

- 日本語

### Navigation

- index
- next |
- previous |
- Groonga v5.0.4-139-g6629adb documentation »
- 7. Reference manual »
- 7.3. Command »

# 7.3.34. `ruby_eval`

## 7.3.34.1. Summary

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

## 7.3.34.2. Syntax

`ruby_eval` has one required parameter:

    ruby_eval script

## 7.3.34.3. 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.

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.

## 7.3.34.4. Parameters

This section describes all parameters.

### 7.3.34.4.1. `script`

Specifies the Ruby script which you want to evaluate.

## 7.3.34.5. 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 Output format about `HEADER`.

`EVALUATED_VALUE`

> `EVALUATED_VALUE` is the evaludated value of `ruby_script`.

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

## 7.3.34.6. See also

### Navigation

- index
- next |
- previous |
- Groonga v5.0.4-139-g6629adb documentation »
- 7. Reference manual »
- 7.3. Command »