21
1
Fork 0
mirror of https://github.com/Evolix/chexpire.git synced 2024-05-15 15:08:38 +02:00
chexpire/app/helpers/domain_helper.rb
2018-05-30 17:01:32 +02:00

13 lines
216 B
Ruby

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