From f4fc599a1d0c32eacb17cbd7794aaabfa9957e58 Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Wed, 18 Aug 2021 17:47:20 -0600 Subject: [PATCH] Add display_name convenience method --- src/spectator/node.cr | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/spectator/node.cr b/src/spectator/node.cr index 4979f6e..c5a64b6 100644 --- a/src/spectator/node.cr +++ b/src/spectator/node.cr @@ -59,10 +59,15 @@ module Spectator Tags.new(metadata.keys) end + # Non-nil name used to show the node name. + def display_name + @name || "" + 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 || "").to_s(io) + display_name.to_s(io) end # Exposes information about the node useful for debugging.