# Copyright (C) 2018 Colin Darie , 2018 Evolix # License: GNU AGPL-3+ (see full text in LICENSE file) module DomainHelper def normalize_domain(str) str.strip.downcase end def tld(str) parts = normalize_domain(str).split(".") fail ArgumentError unless parts.size >= 2 ".#{parts.last}" end end