Sha256: 6f7e6ca611c3553382a9febaf6a3c121eabef9500d12f560d043382446c429cb
Contents?: true
Size: 928 Bytes
Versions: 1
Compression:
Stored size: 928 Bytes
Contents
require 'pony' module Feed2Mail class Report attr_reader :items def initialize(config) @feeds = config.feeds @items = [] @history = History.new config end def to_s out = '' @items.each do |i| out << <<-eoh #{i.title} #{i.uri} eoh end out end def mail(opts) Pony.mail( :via_options => { :arguments => '-i' }, :charset => 'UTF-8', :from => opts[:from], :to => opts[:to], :subject => 'Feed2Mail: new feed items published', :body => to_s ) end def update @feeds.each do |f| f.items.each do |i| unless seen? i @items << i @history << i.uri end end end @history.save! end def seen?(item) @history.has?(item.uri) ? true : false end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
feed2mail-0.0.1 | lib/feed2mail/report.rb |