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

#write(output) ⇒ Object



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

def write(output)
  File.open(output, 'w') do |f|
    f.write(@feed.to_s.gsub('<summary>', '<summary type="html">'))
  end
end