DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Validating A TLD In Ruby1.9.1

  • submit to reddit
sudo gem1.9.1 install addressable
Successfully installed addressable-2.1.1
1 gem installed
Installing ri documentation for addressable-2.1.1...
Installing RDoc documentation for addressable-2.1.1...

sudo gem1.9.1 install alexrabarts-tld -s

Successfully installed alexrabarts-iso_country_codes-0.2.2
Successfully installed alexrabarts-tld-0.6.0
2 gems installed
Installing ri documentation for alexrabarts-iso_country_codes-0.2.2...
Installing ri documentation for alexrabarts-tld-0.6.0...
Updating class cache with 2187 classes...
Installing RDoc documentation for alexrabarts-iso_country_codes-0.2.2...
Installing RDoc documentation for alexrabarts-tld-0.6.0...

require 'tld'

TLD.find('').name #=> "Australia"
TLD.find('').name #=> "Grenada"
TLD.find('').name  #=> "United States"

 - <a href="">Validate a TLD with Ruby</a> []