[#44909] VRDdeClientについて — Toshiyasu Soejima <clev@...2.so-net.ne.jp>

17 messages 2008/05/11

[#44936] yamlとencoding — "Yutaka Kanemoto" <kinpoco@...>

金本と申します。

16 messages 2008/05/14

[ruby-list:44938] RSSが生成されない

From: rubikitch@...
Date: 2008-05-14 21:10:31 UTC
List: ruby-list #44938
るびきちです。

Ruby 1.8.7 / Ruby 1.9だとRSSが生成されません。
オブジェクトは生成されているようです。
それとも使い方が間違っているのでしょうか?

RUBY_VERSION                    # => "1.8.6"
RUBY_RELEASE_DATE               # => "2008-03-03"
require 'rss/2.0'
feed = RSS::Rss.new("2.0", "2.0", "UTF-8")
chan = RSS::Rss::Channel::new
chan.title = "title"
feed.channel = chan

item = RSS::Rss::Channel::Item.new
item.title = "item.title"
item.description = "item.desc"
feed.channel.items << item

puts feed
# >> <?xml version="2.0" encoding="UTF-8"?>
# >> <rss version="2.0">
# >>   <channel>
# >>     <title>title</title>
# >>     <item>
# >>       <title>item.title</title>
# >>       <description>item.desc</description>
# >>     </item>
# >>   </channel>
# >> </rss>


VS

RUBY_VERSION                    # => "1.8.7"
RUBY_RELEASE_DATE               # => "2008-05-14"
require 'rss/2.0'
feed = RSS::Rss.new("2.0", "2.0", "UTF-8")
chan = RSS::Rss::Channel::new
chan.title = "title"
feed.channel = chan

item = RSS::Rss::Channel::Item.new
item.title = "item.title"
item.description = "item.desc"
feed.channel.items << item

feed
# => #<RSS::Rss:0xb7b852c4
#     @channel=
#      #<RSS::Rss::Channel:0xb7b85170
#       @category=[],
#       @cloud=nil,
#       @converter=nil,
#       @copyright=nil,
#       @description=nil,
#       @do_validate=true,
#       @docs=nil,
#       @generator=nil,
#       @image=nil,
#       @item=
#        [#<RSS::Rss::Channel::Item:0xb7b850a8
#          @author=nil,
#          @category=[],
#          @comments=nil,
#          @converter=nil,
#          @description="item.desc",
#          @do_validate=true,
#          @enclosure=nil,
#          @guid=nil,
#          @link=nil,
#          @parent=nil,
#          @pubDate=nil,
#          @source=nil,
#          @title="item.title">],
#       @language=nil,
#       @lastBuildDate=nil,
#       @link=nil,
#       @managingEditor=nil,
#       @parent=nil,
#       @pubDate=nil,
#       @rating=nil,
#       @skipDays=nil,
#       @skipHours=nil,
#       @textInput=nil,
#       @title="title",
#       @ttl=nil,
#       @webMaster=nil>,
#     @converter=nil,
#     @do_validate=true,
#     @encoding="UTF-8",
#     @feed_subtype=nil, # !> method redefined; discarding old pp
#     @feed_type="rss",
#     @feed_version="2.0",
#     @output_encoding=nil,
#     @parent=nil,
#     @standalone=nil,
#     @version="2.0",
#     @xml_stylesheets=[]>
puts feed
# >> 

--
rubikitch
Blog: http://d.hatena.ne.jp/rubikitch/
Site: http://www.rubyist.net/~rubikitch/

In This Thread

Prev Next