Add documentation
This commit is contained in:
parent
7317e44760
commit
a9eeaaf648
|
@ -1,14 +1,20 @@
|
||||||
class Buffer
|
class Buffer
|
||||||
|
-- number -> Buffer
|
||||||
|
-- creates a new Buffer with the given limit number
|
||||||
new: (limit = 5) =>
|
new: (limit = 5) =>
|
||||||
@limit = limit
|
@limit = limit -- number
|
||||||
@data = {}
|
@data = {} -- table
|
||||||
|
|
||||||
|
-- nil
|
||||||
|
-- clears all entries in @data if its length is above number @limit
|
||||||
purge: =>
|
purge: =>
|
||||||
if #@data > @limit
|
if #@data > @limit
|
||||||
table.remove @data, 1
|
table.remove @data, 1
|
||||||
@purge!
|
@purge!
|
||||||
else return
|
else return
|
||||||
|
|
||||||
|
-- anything -> nil
|
||||||
|
-- adds the given line anything to @data and calls the too long purging function
|
||||||
add: (line) =>
|
add: (line) =>
|
||||||
table.insert @data, line
|
table.insert @data, line
|
||||||
@purge!
|
@purge!
|
||||||
|
|
Loading…
Reference in New Issue