diff --git a/src/moonscript/fuckedtail.moon b/src/moonscript/fuckedtail.moon index 8d07654..c933296 100644 --- a/src/moonscript/fuckedtail.moon +++ b/src/moonscript/fuckedtail.moon @@ -1,14 +1,20 @@ class Buffer + -- number -> Buffer + -- creates a new Buffer with the given limit number new: (limit = 5) => - @limit = limit - @data = {} + @limit = limit -- number + @data = {} -- table + -- nil + -- clears all entries in @data if its length is above number @limit purge: => if #@data > @limit table.remove @data, 1 @purge! else return + -- anything -> nil + -- adds the given line anything to @data and calls the too long purging function add: (line) => table.insert @data, line @purge!