0

FeedTools で JRUBY on Rails を使っている人はいますか? FeedTools を実行しようとすると、次のエラーが表示されます。

NameError (undefined local variable or method `parser' for YAML:Module):. 

までコードを追跡しましたmonkey_patch.rb。パーサー ラインで爆撃していますが、私は Ruby と Rails に不慣れで、自分でデバッグできませんでした。奇妙なのは、普通の古い Rails と Ruby で問題なく動作することです。Java コンテナーにデプロイしようとしているので、JRuby が必要です。

require 'rexml/document'
require 'yaml'

module YAML
def YAML.dump( obj, io = nil )
  if obj.kind_of?(FeedTools::Feed) || obj.kind_of?(FeedTools::FeedItem)
    # Dangit, you WILL NOT serialize these things.
    obj.instance_variable_set("@xml_document", nil)
    obj.instance_variable_set("@root_node", nil)
    obj.instance_variable_set("@channel_node", nil)
  end
obj.to_yaml( io || io2 = StringIO.new )
io || ( io2.rewind; io2.read )
end

def YAML.load( io )
      yp = parser.load( io ) # <- Error here
  if yp.kind_of?(FeedTools::Feed) || yp.kind_of?(FeedTools::FeedItem)
    # No really, I'm serious, you WILL NOT deserialize these things.
    yp.instance_variable_set("@xml_document", nil)
    yp.instance_variable_set("@root_node", nil)
    yp.instance_variable_set("@channel_node", nil)
  end
  yp
end
end
4

1 に答える 1

1

これは、JRuby 1.4 で出荷される新しい YAML 実装で修正される可能性が非常に高いです。JRuby ナイトリー ビルドを試してみて、まだ問題があるかどうかお知らせください。

于 2009-08-19T01:43:37.873 に答える