Sha256: 6678f94a4bd775523eb2b588798056d59cd7545ca06091974c5eed91a99ed412
Contents?: true
Size: 1.15 KB
Versions: 2
Compression:
Stored size: 1.15 KB
Contents
## Save RSS as a file -- IKeJI ## ## Save RSS as a file. ## Title, Link, and Description of the RSS can be set. ## The input is expected to be an Array of RSS::RDF::Item. ## ## - module: RSS::save ## config: ## title: An Title ## link: http://www.example.com/hoge.rdf ## description: sample rdf require "rss/maker" @count = Time.now.to_i def save(config,data) rss = RSS::Maker.make("1.0") do |maker| maker.channel.about = config['about'] || config['link'] || "http://example.net/" maker.channel.title = config['title'] || "Pragger output" maker.channel.description = config['description'] || "" maker.channel.link = config['link'] || "http://example.net/" data.each do |i| if(i.instance_of?(RSS::RDF::Item)) i.setup_maker(maker) else item = maker.items.new_item item.title = i.title rescue i.to_s item.link = i.link rescue (config['link'] || "http://example.net/") + "\##{@count}" item.description = i.description rescue i.to_s item.date = i.date rescue Time.now @count += 1 end end end open(config["filename"],"w"){|w| w.puts rss } return data end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
yapra-0.1.0 | legacy_plugins/RSS/save.rb |
yapra-0.1.1 | legacy_plugins/RSS/save.rb |