From cc8acc5fa708b9f24369d71b5e982a0314ca64d7 Mon Sep 17 00:00:00 2001 From: Kaarle Ritvanen Date: Fri, 9 Dec 2016 19:50:10 +0200 Subject: doc: describe functionality used in the network module --- aconf/path.lua | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'aconf/path.lua') diff --git a/aconf/path.lua b/aconf/path.lua index 4e289f5..8091a35 100644 --- a/aconf/path.lua +++ b/aconf/path.lua @@ -1,8 +1,9 @@ --[[ -Copyright (c) 2012-2015 Kaarle Ritvanen +Copyright (c) 2012-2016 Kaarle Ritvanen See LICENSE file for license details --]] +--- @module aconf.model local M = {} local map = require('aconf.util').map @@ -26,12 +27,25 @@ function M.escape(comp) end +--- joins a number of already escaped path components into a single +--- path. +-- @function path.rawjoin +-- @tparam string p1 path component +-- @tparam ?string p2 path component +-- @tparam ?string ... path component +-- @treturn string path function M.rawjoin(p1, p2, ...) if not p2 then return p1 end if not M.is_absolute(p2) then p2 = '/'..p2 end return M.rawjoin((p1 == '/' and '' or p1)..p2, ...) end +--- appends a number of additional components to a path. The appended +-- components are escaped first. +-- @function path.join +-- @tparam string parent path +-- @tparam ?string ... path component +-- @treturn string path function M.join(parent, ...) local args = map(function(c) return M.escape(c) end, {...}) if parent > '' then table.insert(args, 1, parent) end -- cgit v1.2.3