diff options
Diffstat (limited to 'aconf/model/set.lua')
-rw-r--r-- | aconf/model/set.lua | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/aconf/model/set.lua b/aconf/model/set.lua index 897e1bf..dd28a2e 100644 --- a/aconf/model/set.lua +++ b/aconf/model/set.lua @@ -3,6 +3,7 @@ Copyright (c) 2012-2015 Kaarle Ritvanen See LICENSE file for license details --]] +--- @module aconf.model local M = {} local TreeNode = require('aconf.model.field').TreeNode @@ -12,6 +13,13 @@ local pth = require('aconf.path') local util = require('aconf.util') +--- set object, inherits @{node.List}. An instance of this class represents +-- a set object in the data model, in the context of a specific +-- transaction. A set is an unordered collection of primitive +-- values. Members can be inserted to the set using +-- @{node.insert}. Members can be removed by assigning the nil value +-- to the key to be removed. +-- @klass node.Set M.Set = object.class(require('aconf.model.node').List) function M.Set:init(context, params) @@ -48,6 +56,11 @@ function M.Set:init(context, params) mt.save(i, nil) end + --- determines if the given set contains the given value. + -- @function node.contains + -- @tparam node.Set set set + -- @tparam primitive v value + -- @treturn boolean true if the set contains the value function mt.contains(v) return find(v) and true or false end local insert = mt.insert |