lib/sequenceserver/links.rb in sequenceserver-1.1.0.beta11 vs lib/sequenceserver/links.rb in sequenceserver-1.1.0.beta12
- old
+ new
@@ -1,14 +1,13 @@
+require 'erb'
+
module SequenceServer
# Module to contain methods for generating sequence retrieval links.
module Links
- require 'erb'
-
# Provide a method to URL encode _query parameters_. See [1].
include ERB::Util
- #
- alias_method :encode, :url_encode
+ alias encode url_encode
NCBI_ID_PATTERN = /gi\|(\d+)\|/
UNIPROT_ID_PATTERN = /sp\|(\w+)\|/
# Link generators return a Hash like below.
@@ -64,26 +63,26 @@
return nil unless id.match(NCBI_ID_PATTERN)
ncbi_id = Regexp.last_match[1]
ncbi_id = encode ncbi_id
url = "http://www.ncbi.nlm.nih.gov/#{querydb.first.type}/#{ncbi_id}"
{
- :order => 2,
- :title => 'NCBI',
- :url => url,
- :icon => 'fa-external-link'
+ order: 2,
+ title: 'NCBI',
+ url: url,
+ icon: 'fa-external-link'
}
end
def uniprot
return nil unless id.match(UNIPROT_ID_PATTERN)
uniprot_id = Regexp.last_match[1]
uniprot_id = encode uniprot_id
url = "http://www.uniprot.org/uniprot/#{uniprot_id}"
{
- :order => 2,
- :title => 'Uniprot',
- :url => url,
- :icon => 'fa-external-link'
+ order: 2,
+ title: 'Uniprot',
+ url: url,
+ icon: 'fa-external-link'
}
end
end
end