Added comments to RouteEnd. Fixes #5
This commit is contained in:
parent
95994081c3
commit
ad5a1ca400
1 changed files with 9 additions and 0 deletions
|
@ -2,19 +2,24 @@ package feragstring
|
||||||
|
|
||||||
import "fmt"
|
import "fmt"
|
||||||
|
|
||||||
|
// RouteEnd is the struct that automatically ends a route definition
|
||||||
type RouteEnd struct {
|
type RouteEnd struct {
|
||||||
FeragMessage
|
FeragMessage
|
||||||
routeName string
|
routeName string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RouteName returns the formatted route name segment
|
||||||
func (re *RouteEnd) RouteName() string {
|
func (re *RouteEnd) RouteName() string {
|
||||||
return fmt.Sprintf("+11%-13s", re.routeName)
|
return fmt.Sprintf("+11%-13s", re.routeName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetRouteName sets the route name field
|
||||||
func (re *RouteEnd) SetRouteName(routeName string) {
|
func (re *RouteEnd) SetRouteName(routeName string) {
|
||||||
re.routeName = routeName
|
re.routeName = routeName
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewRouteEnd instantiates a new Route End
|
||||||
|
// struct and returns a pointer to it.
|
||||||
func NewRouteEnd() *RouteEnd {
|
func NewRouteEnd() *RouteEnd {
|
||||||
re := RouteEnd{
|
re := RouteEnd{
|
||||||
FeragMessage: FeragMessage{
|
FeragMessage: FeragMessage{
|
||||||
|
@ -25,11 +30,15 @@ func NewRouteEnd() *RouteEnd {
|
||||||
return &re
|
return &re
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Payload returns the formatted FERAG string
|
||||||
|
// for embedding in the message
|
||||||
func (re *RouteEnd) Payload() string {
|
func (re *RouteEnd) Payload() string {
|
||||||
data := re.RouteName()
|
data := re.RouteName()
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Message returns the formatted FERAG string
|
||||||
|
// for the complete route end message
|
||||||
func (re *RouteEnd) Message() string {
|
func (re *RouteEnd) Message() string {
|
||||||
message := re.FeragMessage.MessageTemplate()
|
message := re.FeragMessage.MessageTemplate()
|
||||||
return message(&re.FeragMessage, re.Payload())
|
return message(&re.FeragMessage, re.Payload())
|
||||||
|
|
Loading…
Reference in a new issue