Module: JekyllAdmin::URLable
Overview
Abstract module to be included in Convertible and Document to provide additional, URL-specific functionality without duplicating logic
Instance Method Summary collapse
-
#api_url ⇒ Object
Absolute URL to the API representation of this resource.
- #entries_url ⇒ Object
-
#http_url ⇒ Object
Absolute URL to the HTTP(S) rendered/served representation of this resource.
Instance Method Details
#api_url ⇒ Object
Absolute URL to the API representation of this resource
17 18 19 20 21 22 |
# File 'lib/jekyll-admin/urlable.rb', line 17 def api_url @api_url ||= Addressable::URI.new( :scheme => scheme, :host => host, :port => port, :path => path_with_base("/_api", resource_path) ).normalize.to_s end |
#entries_url ⇒ Object
24 25 26 27 |
# File 'lib/jekyll-admin/urlable.rb', line 24 def entries_url return unless is_a?(Jekyll::Collection) "#{api_url}/entries" end |
#http_url ⇒ Object
Absolute URL to the HTTP(S) rendered/served representation of this resource
7 8 9 10 11 12 13 14 |
# File 'lib/jekyll-admin/urlable.rb', line 7 def http_url return if is_a?(Jekyll::Collection) || is_a?(JekyllAdmin::DataFile) return if is_a?(Jekyll::Document) && !collection.write? @http_url ||= Addressable::URI.new( :scheme => scheme, :host => host, :port => port, :path => path_with_base(JekyllAdmin.site.config["baseurl"], url) ).normalize.to_s end |