Add some method aliases
This commit is contained in:
parent
97467c9958
commit
f0678c2fba
@ -151,6 +151,7 @@ module Swot
|
||||
return false
|
||||
end
|
||||
end
|
||||
alias_method :academic?, :is_academic?
|
||||
|
||||
# Figure out the institution name based on the email address/domain.
|
||||
#
|
||||
@ -162,6 +163,7 @@ module Swot
|
||||
domain = PublicSuffix.parse(text)
|
||||
name_from_academic_domain(domain)
|
||||
end
|
||||
alias_method :school_name, :get_institution_name
|
||||
|
||||
# Figure out if a domain name is a know academic institution.
|
||||
#
|
||||
|
||||
@ -47,4 +47,9 @@ class TestEmail < Test::Unit::TestCase
|
||||
should "returns name of valid institution" do
|
||||
assert_equal Swot::get_institution_name('lreilly@cs.strath.ac.uk'), "University of Strathclyde"
|
||||
end
|
||||
|
||||
should "test aliased methods" do
|
||||
assert_equal Swot::academic?('stanford.edu'), true
|
||||
assert_equal Swot::school_name('lreilly@cs.strath.ac.uk'), "University of Strathclyde"
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user