Class: Debci::Feed

Inherits:
Object
  • Object
show all
Defined in:
lib/debci/feed.rb

Instance Method Summary collapse

Constructor Details

#initialize(news) ⇒ Feed

Returns a new instance of Feed.



7
8
9
10
11
12
13
14
# File 'lib/debci/feed.rb', line 7

def initialize(news)
  @feed = RSS::Maker.make('atom') do |feed|
    feed.channel.author = "#{distro_name} Continuous Integration"
    feed.channel.updated = (news.first && news.first.date) || Time.parse('2020-04-18T21:17:00 UTC')
    yield(feed) if block_given?
    insert_items(news, feed)
  end
end

Instance Method Details

#to_sObject



20
21
22
# File 'lib/debci/feed.rb', line 20

def to_s
  @feed.to_s.gsub('<summary>', '<summary type="html">')
end

#write(output) ⇒ Object



16
17
18
# File 'lib/debci/feed.rb', line 16

def write(output)
  File.write(output, to_s)
end