0

Sinatra経由でRSSを出力したい。以下のコードを書きましたが、何も出力されません。puts不思議なことに、以前に書いたとき、rssコンソールに正しくRSSを出力しました!ブラウザに出力できないのはなぜですか?

#encoding: utf-8

require 'sinatra'
require 'rss'

...

get '/' do

  ...


  rss = RSS::Maker.make("2.0") do |rss|
    rss.channel.about = 'http://hoge/rss.xml'
    rss.channel.title = "hoge"

    ...

  end

  content_type = 'application/xml'  
  # puts rss # => output correctly to console
  rss # => output nothing
end

コード全体: https://github.com/weed/p120905-rss-process-test/blob/master/app.rb

ご親切にありがとうございます。

4

1 に答える 1

3

Sinatra は、RSS オブジェクトをどうするかを知らないようです。

get ブロックの最後の行を

rss.to_s
于 2012-09-05T03:00:05.303 に答える