# in your controller you can use
@domain = CreateDomains.new('car.oline.codes').call #=> returns Domain with name 'car' that is the child of `oline.codes`
@domain.web_address.to_s #=> 'car.oline.codes'
You can use your logic for subtree equality to compare the actual web_address
value objects, which are immutable.
You could also see all the 'parent' strings for a given web_address object
@domain = CreateDomains.new('c.a.r.oline.codes').call
web_address = @domain.web_address #=> array of WebAddress objects
parent_addresses = web_address.parent_addresses
# and mapping to_s would give you
parent_addresses.map(&:to_s) #=> ["oline.codes", "r.oline.codes", "a.r.oline.codes"]
# so you can check for inclusion in parent addresses from some string like
parent_address = WebAddress.from_string('r.oline.codes')
parent_addresses.include?(parent_address) #=> true