Module | YAML |
In: |
lib/feed_tools/monkey_patch.rb
|
# File lib/feed_tools/monkey_patch.rb, line 5 5: def YAML.dump( obj, io = nil ) 6: if obj.kind_of?(FeedTools::Feed) || obj.kind_of?(FeedTools::FeedItem) 7: # Dangit, you WILL NOT serialize these things. 8: obj.instance_variable_set("@xml_document", nil) 9: obj.instance_variable_set("@root_node", nil) 10: obj.instance_variable_set("@channel_node", nil) 11: end 12: obj.to_yaml( io || io2 = StringIO.new ) 13: io || ( io2.rewind; io2.read ) 14: end
# File lib/feed_tools/monkey_patch.rb, line 16 16: def YAML.load( io ) 17: yp = parser.load( io ) 18: if yp.kind_of?(FeedTools::Feed) || yp.kind_of?(FeedTools::FeedItem) 19: # No really, I'm serious, you WILL NOT deserialize these things. 20: yp.instance_variable_set("@xml_document", nil) 21: yp.instance_variable_set("@root_node", nil) 22: yp.instance_variable_set("@channel_node", nil) 23: end 24: yp 25: end