module Xommelier::Atom::LinksExtension

Public Instance Methods

feed_url() click to toggle source
# File lib/xommelier/atom/links_extension.rb, line 13
def feed_url
  detect_linked_href(rel: 'self', type: 'application/atom+xml')
end
html_url() click to toggle source
# File lib/xommelier/atom/links_extension.rb, line 17
def html_url
  detect_linked_href(rel: 'alternate', type: 'text/html')
end

Protected Instance Methods

detect_linked_href(attributes = {}) click to toggle source
# File lib/xommelier/atom/links_extension.rb, line 23
def detect_linked_href(attributes = {})
  links.detect do |link|
    attributes.inject(true) do |result, (attr, value)|
      result && link.send(attr) == value
    end
  end.try(:href)
end