b61afc44e6
* docs: fix typo in component notice * refactor: rename typo param 'pattern' * docs: fix comments typos across project files Cleanup misspellings and wording in comment lines. * docs: improve readability of `CONTRIBUTING.md` * docs: improve readability of `README.md` - Minor typos - Clarify information - Separate sections from paragraphs * docs: add newline below headers in `THEMES.md` Aim's to be consistent with other documents. * docs: fix unname tabpage command reference * docs: reword 'directly bused' for `setup_theme()` * docs: fix extra indent in contribution list * docs: more separation in readme/tabs, remove extra backtick * docs: further improve wording for `setup_theme` * docs: improve wording for `setup` function * docs: missing underscore in lualine/config
44 lines
787 B
Lua
44 lines
787 B
Lua
-- Adapted from https://github.com/rxi/classic/blob/master/classic.lua
|
|
local Object = {}
|
|
|
|
Object.__index = Object
|
|
|
|
-- luacheck: push no unused args
|
|
---Initializer
|
|
function Object:init(...) end
|
|
-- luacheck: pop
|
|
|
|
---Extend base class to create a child class
|
|
function Object:extend()
|
|
local cls = {}
|
|
for k, v in pairs(self) do
|
|
if k:find('__') == 1 then
|
|
cls[k] = v
|
|
end
|
|
end
|
|
cls.__index = cls
|
|
cls.super = self
|
|
setmetatable(cls, self)
|
|
return cls
|
|
end
|
|
|
|
-- luacheck: push no unused args
|
|
function Object:__tostring()
|
|
return 'Object'
|
|
end
|
|
-- luacheck: pop
|
|
|
|
---Creates a new object
|
|
function Object:new(...)
|
|
local obj = setmetatable({}, self)
|
|
obj:init(...)
|
|
return obj
|
|
end
|
|
|
|
---Creates a new object
|
|
function Object:__call(...)
|
|
return self:new(...)
|
|
end
|
|
|
|
return Object
|