S
Sam Roberts
There are lots of mandatory attributes (yes, which are mandatory is
documented on the wiki), but what is mandatory is different for
different RSS versions, and there are no errors raised, #make just
returns 'nil'. This caused me some trouble.
I hacked an extra line into this:
make/0.9.rb:22
if rss.channel
rss
else
+ raise "required channel or image properties are missing!"
nil
end
This isn't a real solution - it doesn't say what property is missing,
and only is in the 0.9 code, somebody who knew the code could do this
much better!
Also, what is "image"? I don't know what to put there, so I just put
some strings, and my RSS reader ignores them.
After I figured out the mandatory, it worked very well, thank you!
Sam
--- example ---
#!/opt/local/bin/ruby -w
require 'rss/maker'
#
# Remove ANY one of the property setting lines, and #make will return nil
# (without my example patch).
#
rss = RSS::Maker.make("0.9") do |maker|
maker.channel.title = "title"
maker.channel.link = "link"
maker.channel.description = "description"
maker.channel.language = "language"
maker.image.url = "maker.image.url"
maker.image.title = "maker.image.title"
item = maker.items.new_item
item.title = "item title"
item.link = "link"
end
puts rss.to_s
documented on the wiki), but what is mandatory is different for
different RSS versions, and there are no errors raised, #make just
returns 'nil'. This caused me some trouble.
I hacked an extra line into this:
make/0.9.rb:22
if rss.channel
rss
else
+ raise "required channel or image properties are missing!"
nil
end
This isn't a real solution - it doesn't say what property is missing,
and only is in the 0.9 code, somebody who knew the code could do this
much better!
Also, what is "image"? I don't know what to put there, so I just put
some strings, and my RSS reader ignores them.
After I figured out the mandatory, it worked very well, thank you!
Sam
--- example ---
#!/opt/local/bin/ruby -w
require 'rss/maker'
#
# Remove ANY one of the property setting lines, and #make will return nil
# (without my example patch).
#
rss = RSS::Maker.make("0.9") do |maker|
maker.channel.title = "title"
maker.channel.link = "link"
maker.channel.description = "description"
maker.channel.language = "language"
maker.image.url = "maker.image.url"
maker.image.title = "maker.image.title"
item = maker.items.new_item
item.title = "item title"
item.link = "link"
end
puts rss.to_s