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
19 20 21 22 23 24 |
# File 'lib/jekyll-admin/urlable.rb', line 19 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
26 27 28 29 30 |
# File 'lib/jekyll-admin/urlable.rb', line 26 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
8 9 10 11 12 13 14 15 16 |
# File 'lib/jekyll-admin/urlable.rb', line 8 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 |