31 lines
690 B
Lua
31 lines
690 B
Lua
local Meta = require "cave.meta"
|
|
local Path = require "cave.path"
|
|
|
|
local Str = Meta.String
|
|
local validate = Meta.validate
|
|
|
|
---@class cave.Context
|
|
---@field dir cave.Path
|
|
---@field name string
|
|
---@field uuid string
|
|
local Context = Meta.derive "Context"
|
|
|
|
---@param dir cave.Path
|
|
---@param name string
|
|
---@param uuid string
|
|
function Context:init(dir, name, uuid)
|
|
validate { dir = { dir, Path }, uuid = { uuid, Str }, name = { name, Str } }
|
|
self.dir = dir
|
|
self.name = name
|
|
self.uuid = uuid
|
|
end
|
|
|
|
---@return string
|
|
function Context:tostring()
|
|
return ("Context(dir=%q, name=%q, uuid=%q)"):format(self.dir, self.name, self.uuid)
|
|
end
|
|
|
|
Context.__tostring = Context.tostring
|
|
|
|
return Context
|