Sha256: a2fb036579f3ad54ff0a7feea5e4625300883b1a84d214767b21f72531f2707c
Contents?: true
Size: 718 Bytes
Versions: 1
Compression:
Stored size: 718 Bytes
Contents
module Shortener::ShortenerHelper # generate a url from either a url string, or a shortened url object def shortened_url(url_object, user=nil) short_url = nil if url_object.class != String #== ShortenedUrl if user.nil? short_url = url_object else # if the user has passed in a shortened url, with a user, then # work out the link for the shortened url and make another with the # passed user short_url = ShortenedUrl.generate(shortened_url(url_object), user) end else short_url = ShortenedUrl.generate(url_object, user) end return short_url.nil? ? nil : shortener_translate_url(short_url.unique_key) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
shortener-0.0.1 | app/helpers/shortener/shortener_helper.rb |