Initial commit
This commit is contained in:
30
lua/cave/context.lua
Normal file
30
lua/cave/context.lua
Normal file
@@ -0,0 +1,30 @@
|
||||
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
|
||||
Reference in New Issue
Block a user