summaryrefslogtreecommitdiff
path: root/last.go
diff options
context:
space:
mode:
Diffstat (limited to 'last.go')
-rw-r--r--last.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/last.go b/last.go
index 34a3022..50524dd 100644
--- a/last.go
+++ b/last.go
@@ -12,21 +12,21 @@ type Msg struct {
Text string
}
-type LastBuf struct {
+type Last struct {
*ring.Ring
}
-func NewLastBuf(n int) *LastBuf {
- return &LastBuf{ring.New(n)}
+func NewLast(n int) *Last {
+ return &Last{ring.New(n)}
}
-func (v *LastBuf) Push(t time.Time, nick, text string) {
+func (v *Last) Push(t time.Time, nick, text string) {
v.Value = Msg{Time: t, Nick: nick, Text: text}
v.Ring = v.Next()
}
// walk through buffer and find last message
-func (v *LastBuf) Last(nick string) string {
+func (v *Last) Last(nick string) string {
var msg string
v.Do(func(v interface{}) {
if l, ok := v.(Msg); ok {
@@ -38,7 +38,7 @@ func (v *LastBuf) Last(nick string) string {
return msg
}
-func (v *LastBuf) Dump(c chan string) {
+func (v *Last) Dump(c chan string) {
v.Do(func(v interface{}) {
if l, ok := v.(Msg); ok {
c <- fmt.Sprintf("%v <%v> %v",