Add doc for get_institution_name

This commit is contained in:
Lee Reilly 2012-04-25 09:26:50 -07:00
parent 6e7e644b3a
commit 9f230d5afd
2 changed files with 5 additions and 2 deletions

View File

@ -33,7 +33,7 @@ nigel@stanford.edu, bawbag@cs.strath.ac.uk, lee@wunizar.es, terrence@ubishops.ca
Swot::is_academic?('harvard.edu') # true
Swot::is_academic?('www.harvard.edu') # true
Swot::is_academic?('http://www.harvard.edu') # true
Swot::is_academic?('http://www.kink.com') # false
Swot::is_academic?('http://www.github.com') # false
Swot::is_academic?('http://www.rangers.co.uk') # false
```
# What is a swot?

View File

@ -152,6 +152,9 @@ module Swot
end
end
# Figure out the institution name based on the email address/domain.
#
# Returns a string with the instution name; nil if nothing is found.
def get_institution_name(text)
text.downcase!
text = text.split("@")[1] if text.include? "@"
@ -183,7 +186,7 @@ module Swot
# Get the FQDN name from a URL or email address.
#
#
# Returns a string with the FQDN; nil if there's an error.
def get_domain(text)
return false if text.nil?
text.downcase!