From f0678c2fba9b62118dfc672f2cc9be18e01dc6d7 Mon Sep 17 00:00:00 2001 From: Lee Reilly Date: Mon, 27 May 2013 21:08:32 -0700 Subject: [PATCH] Add some method aliases --- lib/swot.rb | 2 ++ test/test_swot.rb | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/lib/swot.rb b/lib/swot.rb index 774441fb87..5f40d277b3 100644 --- a/lib/swot.rb +++ b/lib/swot.rb @@ -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. # diff --git a/test/test_swot.rb b/test/test_swot.rb index eb98d470d3..e2f46d47a7 100644 --- a/test/test_swot.rb +++ b/test/test_swot.rb @@ -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