class FeedDuck::AtomFeed

Attributes

parsed_feed[R]

Public Class Methods

new(parsed_feed) click to toggle source
# File lib/feed_duck/atom_feed.rb, line 3
def initialize(parsed_feed)
  @parsed_feed = parsed_feed
end

Public Instance Methods

description()
Alias for: subtitle
entries() click to toggle source
# File lib/feed_duck/atom_feed.rb, line 19
def entries
  parsed_feed.entries.map { |entry| AtomEntry.new(entry) }
end
subtitle() click to toggle source
# File lib/feed_duck/atom_feed.rb, line 15
def subtitle
  parsed_feed.subtitle.content
end
Also aliased as: description
title() click to toggle source
# File lib/feed_duck/atom_feed.rb, line 7
def title
  parsed_feed.title.content
end
to_h() click to toggle source
# File lib/feed_duck/atom_feed.rb, line 25
def to_h
  attributes_hash.merge(entries: entries.map(&:to_h))
end
url() click to toggle source
# File lib/feed_duck/atom_feed.rb, line 11
def url
  parsed_feed.links.reject { |link| link.rel == "self" }.first.href
end

Private Instance Methods

attributes_hash() click to toggle source
# File lib/feed_duck/atom_feed.rb, line 33
def attributes_hash
  public_attributes.each_with_object(Hash.new) do |attr, attribute_hash|
    attribute_hash[attr] = send(attr)
  end
end
public_attributes() click to toggle source
# File lib/feed_duck/atom_feed.rb, line 39
def public_attributes
  [:title, :url, :description, :subtitle]
end