summaryrefslogtreecommitdiffstats
path: root/aconf/model/field.lua
diff options
context:
space:
mode:
authorKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2015-04-03 10:40:28 +0300
committerKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2015-04-10 18:17:00 +0300
commita92dc45aee3f599926c77294328db38c5b2544eb (patch)
tree0f31580b868245cabe733864f9d99901730c3279 /aconf/model/field.lua
parent3baaf91de453d35b095881478be8d88b3fc2b97a (diff)
downloadaconf-a92dc45aee3f599926c77294328db38c5b2544eb.tar.bz2
aconf-a92dc45aee3f599926c77294328db38c5b2544eb.tar.xz
docs: describe functionality used in the dnsmasq modulev0.5.0
Diffstat (limited to 'aconf/model/field.lua')
-rw-r--r--aconf/model/field.lua62
1 files changed, 44 insertions, 18 deletions
diff --git a/aconf/model/field.lua b/aconf/model/field.lua
index 1b44931..daaa9f4 100644
--- a/aconf/model/field.lua
+++ b/aconf/model/field.lua
@@ -69,27 +69,46 @@ end
-- interpretation of the remaining components is specific to the
-- back-end. If not specified, the address is formed by appending the
-- field's name to the address of the parent.
--- @tparam ?|nil|string|{[string]=string,...} be_mode controls how the
--- Augeas back-end will map addresses to Augeas paths. By default,
--- each component of a back-end address is directly mapped to an
--- Augeas path component. This parameter is an exception table
--- applicable to the subtree defined by the field's address. Each key
--- is a relative address pattern, and the corresponding value is a
--- directive applied to matching address components. The *enumerate*
--- directive indicates there can be several Augeas nodes matching the
--- path and the next component is to be interpreted as an index for
--- such nodes. The *parent-value* directive is applicable only to
--- primitive fields and instructs the back-end not to append the last
--- address component at all, causing the parent node's value to be
--- accessed. If the *be\_mode* parameter is defined as a string, it is
--- assumed to be a directive applicable to the field's own address.
--- @tparam nil|{any|{any,string},...} choice array of allowed
--- values. Each value may be a primitive value or a tuple specifying
--- the value used by the data model and a user-friendly value.
--- @tparam ?any default default value for the field
+-- @param be_mode (optional <i>**string**</i> or
+-- <i>**{[string]=string,...}**</i>) controls how the Augeas back-end
+-- will map addresses to Augeas paths. By default, each component of a
+-- back-end address is directly mapped to an Augeas path
+-- component. This parameter is an exception table applicable to the
+-- subtree defined by the field's address. Each key is a relative
+-- address pattern, and the corresponding value is a directive applied
+-- to matching address components. The *enumerate* directive indicates
+-- there can be several Augeas nodes matching the path and the next
+-- component is to be interpreted as an index for such nodes. The
+-- *parent-value* directive is applicable only to primitive fields and
+-- instructs the back-end not to append the last address component at
+-- all, causing the parent node's value to be accessed. If the
+-- *be\_mode* parameter is defined as a string, it is assumed to be a
+-- directive applicable to the field's own address.
+-- @param choice (optional <i>**{primitive**</i> or
+-- <i>**{primitive,string},...}**</i>) array of allowed values. Each
+-- value may be a primitive value or a tuple specifying the value used
+-- by the data model and a user-friendly value.
+-- @param compute (optional <i><b>function(@{node.TreeNode})</b></i>
+-- or <i>**string**</i>) function for computing the value of the field
+-- when not provided by the back-end. The function gets a reference to
+-- the field's parent as an argument. If defined as a string, a method
+-- with the given name is invoked.
+-- @tparam ?primitive default default value for the field
-- @tparam ?boolean required field must be assigned a value if set,
-- defaults to false
+-- @param store (optional <i><b>function(@{node.TreeNode},
+-- primitive)</b></i> or <i>**string**</i>) if this parameter is
+-- defined, the value of the field is not stored according to the
+-- field's back-end address. Rather, the provided function is invoked
+-- with a reference to the parent and the field value. If defined as a
+-- string, a method with the given name is invoked.
-- @tparam ?string ui_name user-friendly name for the field.
+-- @tparam ?boolean visible the field is visible in the user interface
+-- if set, defaults to true
+-- @tparam ?string widget widget for rendering the field in the user
+-- interface. The default widget for non-leaf objects is *link*, which
+-- is a hyperlink to a detailed view to the object. The *inline*
+-- widget renders a non-leaf object embedded in the parent's view.
M.Field = class(M.Member)
function M.Field:init(params)
@@ -431,6 +450,13 @@ function M.TreeNode:validate_saved(context)
end
+--- model field, inherits @{Field}. The value of this field is a <a
+-- href="#Model_objects">model object</a> conforming to the specified
+-- model. A model field with default parameters is implicitly created
+-- when a model is used in lieu of a @{Field}.
+-- @klass Model
+-- @param model (<i>[&lt;Model&gt;](#new)</i>) model describing the
+-- structure of the model objects
M.Model = class(M.TreeNode)
function M.Model:init(params)