summaryrefslogtreecommitdiffstats
path: root/acf/persistence/backends/volatile.lua
diff options
context:
space:
mode:
authorKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2013-05-09 15:23:21 +0300
committerKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2013-05-09 15:24:56 +0300
commitbd7b76e3316959028fc7686357fc916f56a4d10b (patch)
tree97578057c66848c158e185492aa810e42f42a09a /acf/persistence/backends/volatile.lua
parente8e8338ce1493e6eda04d6d745b449b9475ded30 (diff)
downloadaconf-bd7b76e3316959028fc7686357fc916f56a4d10b.tar.bz2
aconf-bd7b76e3316959028fc7686357fc916f56a4d10b.tar.xz
persistence: Augeas back-end rewritten
map identically named nodes to collections implement set function
Diffstat (limited to 'acf/persistence/backends/volatile.lua')
-rw-r--r--acf/persistence/backends/volatile.lua13
1 files changed, 3 insertions, 10 deletions
diff --git a/acf/persistence/backends/volatile.lua b/acf/persistence/backends/volatile.lua
index 339f937..7322323 100644
--- a/acf/persistence/backends/volatile.lua
+++ b/acf/persistence/backends/volatile.lua
@@ -5,14 +5,7 @@ See LICENSE file for license details
module(..., package.seeall)
-local copy = require('acf.util').copy
-
-
-local function keys(tbl)
- local res = {}
- for k, v in pairs(tbl) do table.insert(res, k) end
- return res
-end
+local util = require('acf.util')
backend = require('acf.object').class()
@@ -31,7 +24,7 @@ end
function backend:get(path, tpe)
local res = self:_get(path)
- return type(res) == 'table' and keys(res) or res
+ return type(res) == 'table' and util.keys(res) or res
end
function backend:_set(path, tpe, value)
@@ -40,7 +33,7 @@ function backend:_set(path, tpe, value)
if #path == 0 then self.data = value
else
- local comps = copy(path)
+ local comps = util.copy(path)
local name = comps[#comps]
table.remove(comps)
self:_get(comps)[name] = value