21
1
Fork 0
mirror of https://github.com/Evolix/chexpire.git synced 2024-06-04 00:25:07 +02:00
chexpire/app/helpers/domain_helper.rb

13 lines
216 B
Ruby
Raw Normal View History

2018-05-29 22:33:35 +02:00
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