Hi everybody,
i’m new in ruby
here is i get an error.
source code
require ‘rss/2.0’
require ‘open-uri’
url = ‘http://www.nationalbank.kz/rss/rates.xml’
feed = RSS::Parser.parse(open(url).read, false)
puts “=== Channel: #{feed.channel.title} ===”
feed.items.each do |item|
puts item.title
puts " (#{item.pubDate})"
puts
puts item.description
puts item.index
end
partial rss feed (you can see all feed following the url = ‘http://
www.nationalbank.kz/rss/rates.xml’)
error message:
auto_rss.rb:12: undefined method index' for #<RSS::Rss::Channel::Item: 0x2d3758c> (NoMethodError) from auto_rss.rb:7:in
each’
from auto_rss.rb:7
the code goes good if i not out put “puts item.index”,
but as you see i can’t change the feed
and i need the value of item.
is there any way to get the value of item
please help me,
best regards from Kazakhstan / Shymkent city