Fixes #7164: Cannot create a domain that starts or ends with '.'

respond_to second argument is if to include or not private methods.