diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-05-17 20:10:25 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-05-17 20:10:25 +0100 |
commit | cef8b983ab7efbf78709c2ed7d5a519a1090df5f (patch) | |
tree | f25a7d94867ba4382145ae5c676958e1523afa5b | |
parent | 4bc539a69fb8f5a44786c8f480fa2c12ebdbdb65 (diff) | |
download | rspamd-cef8b983ab7efbf78709c2ed7d5a519a1090df5f.tar.gz rspamd-cef8b983ab7efbf78709c2ed7d5a519a1090df5f.zip |
[Minor] Add docs
-rw-r--r-- | lualib/lua_maps_expressions.lua | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lualib/lua_maps_expressions.lua b/lualib/lua_maps_expressions.lua index 495820703..38cd0f296 100644 --- a/lualib/lua_maps_expressions.lua +++ b/lualib/lua_maps_expressions.lua @@ -85,6 +85,27 @@ local function process_func(elt, task) return nil end +--[[[ +-- @function lua_maps_expression.create(config, object, module_name) +-- Creates a new maps combination from `object` for `module_name`. +-- The input should be table with the following fields: +-- +-- * `rules` - kv map of rules where each rule has `map` and `selector` mandatory attribute, also `type` for map type, e.g. `regexp` +-- * `expression` - Rspamd expression where elements are names from `rules` field, e.g. `ip & from` +-- +-- This function returns an object with public method `process(task)` that checks +-- a task for the conditions defined in `expression` and `rules` and returns 2 values: +-- +-- 1. value returned by an expression (e.g. 1 or 0) +-- 2. an map (rule_name -> table) of matches, where each element has the following fields: +-- * `matched` - selector's value +-- * `value` - map's result +-- +-- In case if `expression` is false a `nil` value is returned. +-- @param {rspamd_config} cfg rspamd config +-- @param {table} obj configuration table +-- +--]] local function create(cfg, obj, module_name) if not module_name then module_name = 'lua_maps_expressions' end |