cel 0.4.0 has been released.
cel is a pure Ruby implementation of Google Common Expression Language,
GitHub - google/cel-spec: Common Expression Language -- specification and binary representation.
The Common Expression Language (CEL) implements common semantics for
expression evaluation, enabling different applications to more easily
interoperate.
require "cel"
# set the environment
env = Cel::Environment.new(name: :string, group: :string)
# parse
ast = env.compile('name.startsWith("/groups/" + group)')
# check
prg = env.program(ast)
# evaluate
prg.evaluate(name: Cel::String.new("/groups/acme.co/documents/secret-stuff
"),
group: Cel::String.new("acme.co")) #=> true
# or do it all in one go
env.evaluate('name.startsWith("/groups/" + group)',
name: Cel::String.new("/groups/acme.co/documents/secret-stuff"),
group: Cel::String.new("acme.co")
)
Here are the updates since the last release:
## [0.4.0] - 2025-11-18
### Features
`cel-ruby` supports the defined set of [CEL extensions](
cel-go/ext/README.md at master · google/cel-go · GitHub): math, string,
bind and encoders.
Cel::Environment.new.evaluate("math.bitShiftLeft(1, 2) ") #=> returns 4
### Improvements
When the `tzinfo-data` gem is loaded, expressions will support
human-friendly timezones, such as "US/Central", for timestamps.
## [0.3.1] - 2025-08-01
### Improvements
* Support for depth protection, using the defaults from the spec (ex:
recursion depth of 32, nesting depth of 32), and supporting API to override
them (ex: `Cel::Environment.new(max_recursion_depth: 42))`).
* lazy-evaluating bindings to avoid upfront costly transformations of ruby
objects into cel objects which are ultimately not used in expressions.
### Bugfixes
* `has()` macro correctly works for maps.