class Mako::Feed

Attributes

articles[RW]
feed_url[RW]
title[RW]
url[RW]

Public Class Methods

new(args) click to toggle source
# File lib/mako/feed.rb, line 7
def initialize(args)
  @url = args.fetch(:url)
  @title = args.fetch(:title)
  @articles = []
end

Public Instance Methods

articles_asc() click to toggle source

Returns the articles array sorted by date published ascending (oldest first).

@return [Array]

# File lib/mako/feed.rb, line 17
def articles_asc
  articles.sort_by(&:published)
end
articles_desc() click to toggle source

Returns the articles array sorted by date published descending (newest first).

@return [Array]

# File lib/mako/feed.rb, line 25
def articles_desc
  articles_asc.reverse
end