0
JRuby on RailsとFeedToolsを使用している人はいますか?私はFeedToolsを実行しようとすると、私は次のエラーを取得しています:JRuby、Rails、およびFeedTool
NameError (undefined local variable or method `parser' for YAML:Module):.
私はダウンmonkey_patch.rb
にコードを追跡してきました。それはパーサーラインに爆破されていますが、私はRubyとRailsが初めてで、自分でそれをデバッグできませんでした。変わったのは、普通の古いRailsとRubyでうまくいきます。 JRubyが必要なのは、私がJavaコンテナにデプロイしようとしているからです。
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