tld 0.6.2 → 0.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +4 -0
- data/README.rdoc +1 -1
- data/VERSION.yml +2 -2
- data/lib/tld/cc_tld.rb +27 -0
- data/rakelib/tld.rb +21 -2
- data/tld.gemspec +1 -1
- metadata +3 -3
data/History.txt
CHANGED
data/README.rdoc
CHANGED
data/VERSION.yml
CHANGED
data/lib/tld/cc_tld.rb
CHANGED
@@ -747,5 +747,32 @@ class TLD
|
|
747
747
|
class ZW < CcTld #:nodoc:
|
748
748
|
self.tld = %q{zw}
|
749
749
|
end
|
750
|
+
class AC < CcTld #:nodoc:
|
751
|
+
self.tld = %q{ac}
|
752
|
+
end
|
753
|
+
class EU < CcTld #:nodoc:
|
754
|
+
self.tld = %q{eu}
|
755
|
+
end
|
756
|
+
class SU < CcTld #:nodoc:
|
757
|
+
self.tld = %q{su}
|
758
|
+
end
|
759
|
+
class UK < CcTld #:nodoc:
|
760
|
+
self.tld = %q{uk}
|
761
|
+
end
|
762
|
+
class AN < CcTld #:nodoc:
|
763
|
+
self.tld = %q{an}
|
764
|
+
end
|
765
|
+
class YU < CcTld #:nodoc:
|
766
|
+
self.tld = %q{yu}
|
767
|
+
end
|
768
|
+
class TP < CcTld #:nodoc:
|
769
|
+
self.tld = %q{tp}
|
770
|
+
end
|
771
|
+
class YU < CcTld #:nodoc:
|
772
|
+
self.tld = %q{yu}
|
773
|
+
end
|
774
|
+
class ZR < CcTld #:nodoc:
|
775
|
+
self.tld = %q{zr}
|
776
|
+
end
|
750
777
|
end # end CcTld
|
751
778
|
end # end TLD
|
data/rakelib/tld.rb
CHANGED
@@ -14,20 +14,39 @@ class TLD
|
|
14
14
|
def self.get
|
15
15
|
tlds = []
|
16
16
|
doc = Nokogiri::HTML.parse(open('http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2'))
|
17
|
+
|
18
|
+
# Officially assigned code elements
|
17
19
|
node = doc.search('#Officially_assigned_code_elements').first.parent
|
20
|
+
tlds.concat parse_from_next_sibling_table(node, 3)
|
21
|
+
|
22
|
+
# Exceptional reservations
|
23
|
+
node = doc.search('#Exceptional_reservations').first.parent
|
24
|
+
tlds.concat parse_from_next_sibling_table(node, 2)
|
25
|
+
|
26
|
+
# Transitional reservations
|
27
|
+
node = doc.search('#Transitional_reservations').first.parent
|
28
|
+
tlds.concat parse_from_next_sibling_table(node, 3)
|
29
|
+
|
30
|
+
Task.to_ruby(tlds, 'CcTld', :cc)
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.parse_from_next_sibling_table(node, td_index)
|
34
|
+
tlds = []
|
35
|
+
|
18
36
|
while node = node.next_sibling
|
19
37
|
break if node.name == 'table'
|
20
38
|
end
|
39
|
+
|
21
40
|
node.search('tr').each do |tr|
|
22
41
|
tr.search('td').each_with_index do |td, index|
|
23
|
-
next unless index ==
|
42
|
+
next unless index == td_index
|
24
43
|
tld = td.search('a').text.upcase.gsub(/^\./, '')
|
25
44
|
next unless tld.match(/^\w\w$/)
|
26
45
|
tlds.push(tld)
|
27
46
|
end
|
28
47
|
end
|
29
48
|
|
30
|
-
|
49
|
+
tlds
|
31
50
|
end
|
32
51
|
end # end UpdateCcTlds
|
33
52
|
|
data/tld.gemspec
CHANGED
metadata
CHANGED