Move symolic logic to separate method

This commit is contained in:
Michael Miller 2021-03-31 16:15:09 -06:00
parent 0b2ea79329
commit bf17bc95ac
No known key found for this signature in database
GPG key ID: FB9F12F7C646A4AD

View file

@ -71,13 +71,20 @@ module Spectator
# Add padding between the node names
# only if the names don't appear to be symbolic.
# Skip blank group names (like the root group).
io << ' ' unless !group.name? || # ameba:disable Style/NegatedConditionsInUnless
(group.name?.is_a?(Symbol) && name.is_a?(String) &&
(name.starts_with?('#') || name.starts_with?('.')))
io << ' ' unless symbolic_name?(group, name)
end
name.to_s(io)
end
# Checks if the full name and description of the node is symbolic.
# This means that a type or method name was referenced.
# Slightly different formatting is applied for symbolic node names.
private def symbolic_name?(group, name)
!group.name? ||
(group.name?.is_a?(Symbol) && name.is_a?(String) &&
(name.starts_with?('#') || name.starts_with?('.')))
end
end
end
end