From ad5a1ca4005f837d25ad794f3cda3dd9645ba743 Mon Sep 17 00:00:00 2001 From: Oliver Jakoubek Date: Mon, 6 Jul 2020 20:37:21 +0200 Subject: [PATCH] Added comments to RouteEnd. Fixes #5 --- route_end.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/route_end.go b/route_end.go index 0ee5e95..a43be65 100644 --- a/route_end.go +++ b/route_end.go @@ -2,19 +2,24 @@ package feragstring import "fmt" +// RouteEnd is the struct that automatically ends a route definition type RouteEnd struct { FeragMessage routeName string } +// RouteName returns the formatted route name segment func (re *RouteEnd) RouteName() string { return fmt.Sprintf("+11%-13s", re.routeName) } +// SetRouteName sets the route name field func (re *RouteEnd) SetRouteName(routeName string) { re.routeName = routeName } +// NewRouteEnd instantiates a new Route End +// struct and returns a pointer to it. func NewRouteEnd() *RouteEnd { re := RouteEnd{ FeragMessage: FeragMessage{ @@ -25,11 +30,15 @@ func NewRouteEnd() *RouteEnd { return &re } +// Payload returns the formatted FERAG string +// for embedding in the message func (re *RouteEnd) Payload() string { data := re.RouteName() return data } +// Message returns the formatted FERAG string +// for the complete route end message func (re *RouteEnd) Message() string { message := re.FeragMessage.MessageTemplate() return message(&re.FeragMessage, re.Payload())