mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Display <root> when to_s is called directly on the root group
This commit is contained in:
parent
6e7d215f69
commit
8b12262c62
1 changed files with 9 additions and 5 deletions
|
@ -112,11 +112,15 @@ module Spectator
|
||||||
|
|
||||||
# Constructs the full name or description of the example group.
|
# Constructs the full name or description of the example group.
|
||||||
# This prepends names of groups this group is part of.
|
# This prepends names of groups this group is part of.
|
||||||
def to_s(io : IO) : Nil
|
def to_s(io : IO, *, nested = false) : Nil
|
||||||
# Prefix with group's full name if the node belongs to a group.
|
unless parent = @group
|
||||||
return unless parent = @group
|
# Display special string when called directly.
|
||||||
|
io << "<root>" unless nested
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
parent.to_s(io)
|
# Prefix with group's full name if the node belongs to a group.
|
||||||
|
parent.to_s(io, nested: true)
|
||||||
name = @name
|
name = @name
|
||||||
|
|
||||||
# Add padding between the node names
|
# Add padding between the node names
|
||||||
|
@ -126,7 +130,7 @@ module Spectator
|
||||||
(parent.name?.is_a?(Symbol) && name.is_a?(String) &&
|
(parent.name?.is_a?(Symbol) && name.is_a?(String) &&
|
||||||
(name.starts_with?('#') || name.starts_with?('.')))
|
(name.starts_with?('#') || name.starts_with?('.')))
|
||||||
|
|
||||||
super
|
super(io)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Adds the specified *node* to the group.
|
# Adds the specified *node* to the group.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue