Introducing the Polyrex links gem

The polyrex-links gem was intended to run as a back-end web service to handle clean URL requests and return the associated longer URL. I've been experimenting with QR codes, and I've reached the conclusion it's better to change the associated URL behind a clean URL, than it is to regenerate and print out QR codes each time.

require 'polyrex-links'

lines =<<LINES
food http://kitchen.com/food
  fruit http://kitchen.com/fruit
    apples http://kitchen.com/fruit?q=apples
    pears http://kitchen.com/fruit?q=pears
spoons http://kitchen.com/spoons
LINES

links = PolyrexLinks.new
links.parse lines
puts links.to_xml pretty: true

links.locate "food/fruit/apples"
#=> "http://kitchen.com/fruit?q=apples"

links.locate "spoons"
#=> "http://kitchen.com/spoons"

Tags:
Source:
1459hrs.txt
Published:
13-10-2011 14:59