FeelEx (feel_ex v0.2.0)

A friendly expression language helps users define decision logic without needing deep technical expertise. This language is based on the FEEL(Friendly Enough Expression Language). For more information regarding FEEL, please take a look at the official OMG specification at https://www.omg.org/dmn/.

Summary

Functions

Evaluates an expression.

Evaluates an expression against a context. See https://github.com/ExSemantic/feel_ex/blob/master/README.md to see more examples in detail.

Run a unary test with a given unary expression and input value.

Run a unary test with a given unary expression, input value, context.

Functions

evaluate(expression)

Evaluates an expression.

Examples

iex> FeelEx.evaluate("if true then 2+2 else 3+3")
%FeelEx.Value{value: 4, type: :number}

evaluate(context, expression)

Evaluates an expression against a context. See https://github.com/ExSemantic/feel_ex/blob/master/README.md to see more examples in detail.

Examples

iex> FeelEx.evaluate(%{a: true}, "if a then 2+2 else 3+3")
%FeelEx.Value{value: 4, type: :number}

unary_test(expression, input_value)

Run a unary test with a given unary expression and input value.

Examples

iex FeelEx.unary_test("<5",3)
%FeelEx.Value{value: true, type: :boolean}
iex> FeelEx.unary_test("<2",3)
%FeelEx.Value{value: false, type: :boolean}
iex> FeelEx.unary_test("(2..5)",3)
%FeelEx.Value{value: true, type: :boolean}
iex> FeelEx.unary_test("(2..5)",2)
%FeelEx.Value{value: false, type: :boolean}
%FeelEx.Value{value: false, type: :boolean}
iex> FeelEx.unary_test("[2..5]",5)
%FeelEx.Value{value: true, type: :boolean}
iex> FeelEx.unary_test("[2..5)",5)
%FeelEx.Value{value: false, type: :boolean}

unary_test(expression, input_value, context)

Run a unary test with a given unary expression, input value, context.

Examples

iex> FeelEx.unary_test("<a",3,%{a: 2})
%FeelEx.Value{value: false, type: :boolean}
iex> FeelEx.unary_test("<a",3,%{a: 5})
%FeelEx.Value{value: true, type: :boolean}