module Tight::Engine::Url

Public Instance Methods

se_url( obj, method = :show, opts = {} ) click to toggle source
# File lib/tight-engine/url.rb, line 4
def se_url( obj, method = :show, opts = {} )
  if method.kind_of? Hash
    opts = method
    method = :show
  end
  url = case obj
  when NewsArticle
    '/news' / method / obj.slug
  when FormsCard
    '/forms' / method / obj.slug
  when Page
    obj.path
  else
    swift.module_root ? swift.module_root / method / obj.slug : '/'
  end
  if opts[:absolute]
    absolute_url url
  else
    url
  end
end