module Photish::Gallery::Traits::Urlable

Public Instance Methods

base_url_parts() click to toggle source
# File lib/photish/gallery/traits/urlable.rb, line 17
def base_url_parts
  @base_url_parts ||= (parent.base_url_parts +
                       [slugify(base_url_name)]).compact
end
host() click to toggle source
# File lib/photish/gallery/traits/urlable.rb, line 22
def host
  @host ||= absolute_uris? ? url_info_host : ''
end
url() click to toggle source
# File lib/photish/gallery/traits/urlable.rb, line 5
def url
  @url ||= [host, url_parts].flatten.join('/')
end
url_parts() click to toggle source
# File lib/photish/gallery/traits/urlable.rb, line 13
def url_parts
  @url_parts ||= base_url_parts + [url_end]
end
url_path() click to toggle source
# File lib/photish/gallery/traits/urlable.rb, line 9
def url_path
  @url_path ||= url_parts.join(File::SEPARATOR)
end

Private Instance Methods

absolute_uris?() click to toggle source
# File lib/photish/gallery/traits/urlable.rb, line 32
def absolute_uris?
  url_info.type == 'absolute_uri'
end
slugify(word) click to toggle source
# File lib/photish/gallery/traits/urlable.rb, line 28
def slugify(word)
  CGI.escape(word.downcase.gsub(' ', '-')) if word
end
url_info_host() click to toggle source
# File lib/photish/gallery/traits/urlable.rb, line 36
def url_info_host
  url_info.host || ''
end