module Feedjira::AtomEntryUtilities

Public Class Methods

included(mod) click to toggle source
# File lib/feedjira/atom_entry_utilities.rb, line 5
def self.included(mod)
  mod.class_exec do
    element :title, as: :raw_title, with: { type: "html" }
    element :title, as: :raw_title, with: { type: "xhtml" }
    element :title, as: :raw_title, with: { type: "xml" }
    element :title, as: :title, with: { type: "text" }
    element :title, as: :title, with: { type: nil }
    element :title, as: :title_type, value: :type

    element :name, as: :author
    element :content
    element :summary
    element :enclosure, as: :image, value: :href

    element :published
    element :id, as: :entry_id
    element :created, as: :published
    element :issued, as: :published
    element :updated
    element :modified, as: :updated

    elements :category, as: :categories, value: :term

    element :link, as: :url, value: :href, with: {
      type: "text/html",
      rel: "alternate"
    }

    elements :link, as: :links, value: :href
  end
end

Public Instance Methods

title() click to toggle source
# File lib/feedjira/atom_entry_utilities.rb, line 37
def title
  @title ||=
    case @raw_title
    when String
      Loofah.fragment(@raw_title).xpath("normalize-space(.)")
    else
      @title
    end
end
url() click to toggle source
# File lib/feedjira/atom_entry_utilities.rb, line 47
def url
  @url ||= links.first
end