Sha256: c616d6c3829447433a907b857bc19cc8482394a5d7e6a6540bfcce27b451f3b6
Contents?: true
Size: 740 Bytes
Versions: 1
Compression:
Stored size: 740 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 = Shortener::ShortenedUrl.generate(shortened_url(url_object), user) end else short_url = Shortener::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.2 | app/helpers/shortener/shortener_helper.rb |