Add display_name convenience method

This commit is contained in:
Michael Miller 2021-08-18 17:47:20 -06:00
parent 01d1a8736e
commit f4fc599a1d
No known key found for this signature in database
GPG key ID: F9A0C5C65B162436

View file

@ -59,10 +59,15 @@ module Spectator
Tags.new(metadata.keys)
end
# Non-nil name used to show the node name.
def display_name
@name || "<anonymous>"
end
# Constructs the full name or description of the node.
# This prepends names of groups this node is part of.
def to_s(io)
(@name || "<anonymous>").to_s(io)
display_name.to_s(io)
end
# Exposes information about the node useful for debugging.