Seekr Code
5 12 2007I leave the main (and very simple) method below. Go to the subversion repository to find the complete code of Seekr (license: GNU Affero GPL). You may want to go to the camping site.
def get(key)
vars=key.split('/')
size=vars.size - 1
list=YAML.load(IO.read('list.yml'))
case size
when 0
url="http://www.google.com/search?q=" + key
when 1
#e.g. seekr.es/w/free_software -> http://en.wikipedia.org/wiki/Free_software
url=list[vars[0]]
url.gsub!("$1$",vars[1]) if url
else
#e.g. seekr.es/w/es/GNU -> http://es.wikipedia.org/wiki/GNU
url=list[vars[0] + size.to_s]
size.times{|n| url.gsub!("$#{n+1}$",vars[n+1])} if url
end
if url
redirect url
else
...
end
end






[…] No se si existirá algo similar, pero como no cuesta casi nada programarlo (ya publicaré… ver el código), no me he detenido a […]
[…] Update: Seekr code […]