Skip to content

Commit 8a6283d

Browse files
committed
use naughty or nice 2.0.0
1 parent a999f0f commit 8a6283d

File tree

5 files changed

+21
-12
lines changed

5 files changed

+21
-12
lines changed

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
source "http://rubygems.org"
22

33
gem 'public_suffix'
4-
gem 'naughty_or_nice', "~> 1.0"
4+
gem 'naughty_or_nice', "~> 2.0"
55

66
group :development do
77
gem "nokogiri", "~> 1.5"

lib/swot.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ def from_path(path_string_or_path)
5252
# Returns true if the domain name belongs to an academic institution;
5353
# false otherwise.
5454
def valid?
55-
if domain.nil? || domain_parts.nil?
55+
if domain.nil?
5656
false
57-
elsif BLACKLIST.any? { |d| domain =~ /(\A|\.)#{Regexp.escape(d)}\z/ }
57+
elsif BLACKLIST.any? { |d| domain.to_s =~ /(\A|\.)#{Regexp.escape(d)}\z/ }
5858
false
59-
elsif ACADEMIC_TLDS.include?(domain_parts.tld)
59+
elsif ACADEMIC_TLDS.include?(domain.tld)
6060
true
6161
elsif academic_domain?
6262
true
@@ -87,6 +87,6 @@ def academic_domain?
8787
private
8888

8989
def file_path
90-
@file_path ||= File.join(Swot::domains_path, domain_parts.domain.to_s.split(".").reverse) + ".txt"
90+
@file_path ||= File.join(Swot::domains_path, domain.domain.to_s.split(".").reverse) + ".txt"
9191
end
9292
end

lib/swot/collection_methods.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module SwotCollectionMethods
44

55
# Returns an array of domain strings.
66
def all_domains
7-
each_domain.map(&:domain)
7+
each_domain.map(&:to_s)
88
end
99

1010
# Yields a Swot instance for every domain under lib/domains. Does not

swot.gemspec

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
99

1010
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
1111
s.authors = ["Lee Reilly"]
12-
s.date = "2015-06-30"
12+
s.date = "2015-07-09"
1313
s.description = "Identify email addresses or domains names that belong to colleges or universities. Help automate the process of approving or rejecting academic discounts."
1414
s.email = "[email protected]"
1515
s.extra_rdoc_files = [
@@ -1544,6 +1544,7 @@ Gem::Specification.new do |s|
15441544
"lib/domains/cz/vsfs.txt",
15451545
"lib/domains/cz/vslib.txt",
15461546
"lib/domains/cz/vsp.txt",
1547+
"lib/domains/cz/vspj.txt",
15471548
"lib/domains/cz/vutbr.txt",
15481549
"lib/domains/cz/zcu.txt",
15491550
"lib/domains/de/akad.txt",
@@ -1726,6 +1727,7 @@ Gem::Specification.new do |s|
17261727
"lib/domains/de/hs-magdeburg.txt",
17271728
"lib/domains/de/hs-mannheim.txt",
17281729
"lib/domains/de/hs-mittweida.txt",
1730+
"lib/domains/de/hs-neu-ulm.txt",
17291731
"lib/domains/de/hs-offenburg.txt",
17301732
"lib/domains/de/hs-osnabrueck.txt",
17311733
"lib/domains/de/hs-owl.txt",
@@ -1892,6 +1894,7 @@ Gem::Specification.new do |s|
18921894
"lib/domains/de/unibw.txt",
18931895
"lib/domains/de/uos.txt",
18941896
"lib/domains/de/upb.txt",
1897+
"lib/domains/de/vwa-gruppe-net.txt",
18951898
"lib/domains/de/w-hs.txt",
18961899
"lib/domains/de/wak-sh.txt",
18971900
"lib/domains/de/whu-koblenz.txt",
@@ -4743,6 +4746,7 @@ Gem::Specification.new do |s|
47434746
"lib/domains/in/ac/unipune.txt",
47444747
"lib/domains/in/ac/vit.txt",
47454748
"lib/domains/in/ac/vvpedulink.txt",
4749+
"lib/domains/in/aryacollege.txt",
47464750
"lib/domains/in/edu/gtu.txt",
47474751
"lib/domains/in/edu/karunya.txt",
47484752
"lib/domains/in/edu/skpit.txt",
@@ -5386,6 +5390,7 @@ Gem::Specification.new do |s|
53865390
"lib/domains/jp/ac/u-keiai.txt",
53875391
"lib/domains/jp/ac/u-tokai.txt",
53885392
"lib/domains/jp/ac/u-tokyo.txt",
5393+
"lib/domains/jp/ac/ynu.txt",
53895394
"lib/domains/jp/chibakoudai.txt",
53905395
"lib/domains/jp/co/termnet.txt",
53915396
"lib/domains/jp/keio.txt",
@@ -5395,6 +5400,7 @@ Gem::Specification.new do |s|
53955400
"lib/domains/jp/sendai-nct.txt",
53965401
"lib/domains/jp/senshu-u.txt",
53975402
"lib/domains/jp/waseda.txt",
5403+
"lib/domains/jp/ynu.txt",
53985404
"lib/domains/ke/ac/anu.txt",
53995405
"lib/domains/ke/ac/egerton.txt",
54005406
"lib/domains/ke/ac/iu.txt",
@@ -6096,6 +6102,7 @@ Gem::Specification.new do |s|
60966102
"lib/domains/net/ubuea.txt",
60976103
"lib/domains/net/ucasal.txt",
60986104
"lib/domains/net/ulatina.txt",
6105+
"lib/domains/net/unesc.txt",
60996106
"lib/domains/net/univ-mngb.txt",
61006107
"lib/domains/net/universityofsomalia.txt",
61016108
"lib/domains/net/uoit.txt",
@@ -6273,6 +6280,7 @@ Gem::Specification.new do |s|
62736280
"lib/domains/org/hsrw.txt",
62746281
"lib/domains/org/icu-edu.txt",
62756282
"lib/domains/org/internationaluniversity-schoolofmedicine.txt",
6283+
"lib/domains/org/ipeindia.txt",
62766284
"lib/domains/org/ipiaget.txt",
62776285
"lib/domains/org/islahonline.txt",
62786286
"lib/domains/org/khazar.txt",
@@ -7160,6 +7168,7 @@ Gem::Specification.new do |s|
71607168
"lib/domains/ru/vstu.txt",
71617169
"lib/domains/ru/vsu.txt",
71627170
"lib/domains/ru/vvsu.txt",
7171+
"lib/domains/ru/vyatsu.txt",
71637172
"lib/domains/ru/wsnet.txt",
71647173
"lib/domains/ru/yar.txt",
71657174
"lib/domains/ru/yaroslavl/rgata.txt",
@@ -8074,7 +8083,7 @@ Gem::Specification.new do |s|
80748083

80758084
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
80768085
s.add_runtime_dependency(%q<public_suffix>, [">= 0"])
8077-
s.add_runtime_dependency(%q<naughty_or_nice>, ["~> 1.0"])
8086+
s.add_runtime_dependency(%q<naughty_or_nice>, ["~> 2.0"])
80788087
s.add_development_dependency(%q<nokogiri>, ["~> 1.5"])
80798088
s.add_development_dependency(%q<rake>, ["~> 10.0"])
80808089
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
@@ -8083,7 +8092,7 @@ Gem::Specification.new do |s|
80838092
s.add_development_dependency(%q<minitest>, ["~> 4.7.5"])
80848093
else
80858094
s.add_dependency(%q<public_suffix>, [">= 0"])
8086-
s.add_dependency(%q<naughty_or_nice>, ["~> 1.0"])
8095+
s.add_dependency(%q<naughty_or_nice>, ["~> 2.0"])
80878096
s.add_dependency(%q<nokogiri>, ["~> 1.5"])
80888097
s.add_dependency(%q<rake>, ["~> 10.0"])
80898098
s.add_dependency(%q<rdoc>, ["~> 3.12"])
@@ -8093,7 +8102,7 @@ Gem::Specification.new do |s|
80938102
end
80948103
else
80958104
s.add_dependency(%q<public_suffix>, [">= 0"])
8096-
s.add_dependency(%q<naughty_or_nice>, ["~> 1.0"])
8105+
s.add_dependency(%q<naughty_or_nice>, ["~> 2.0"])
80978106
s.add_dependency(%q<nokogiri>, ["~> 1.5"])
80988107
s.add_dependency(%q<rake>, ["~> 10.0"])
80998108
s.add_dependency(%q<rdoc>, ["~> 3.12"])

test/test_collection_methods.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ def write_domain_file(domain, school_name = 'The University')
3737
Swot.each_domain { |d| domains << d }
3838
assert_equal domains.size, 2
3939
assert_equal true, domains.all?{ |d| d.is_a? Swot }
40-
assert_includes domains.map(&:domain), "students.texas.edu"
41-
assert_includes domains.map(&:domain), "mit.edu"
40+
assert_includes domains.map(&:to_s), "students.texas.edu"
41+
assert_includes domains.map(&:to_s), "mit.edu"
4242
end
4343
end
4444
end

0 commit comments

Comments
 (0)