From 0a44338d09e921440fac821b1db8d03e71a10ff0 Mon Sep 17 00:00:00 2001 From: Spencer Rinehart Date: Fri, 6 Mar 2009 10:08:06 -0500 Subject: irc: monkeypatch Singleton to make _load and _dump public. This is to fix a possible bug in newer versions of ruby where _load was declared private in singletons. This would lead to errors where Marshal could not restore the Singleton. This "bug" was introduced to ruby in revisions 16659 and 17396. --- lib/rbot/irc.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib/rbot') diff --git a/lib/rbot/irc.rb b/lib/rbot/irc.rb index 4c462bb3..9a9998e7 100644 --- a/lib/rbot/irc.rb +++ b/lib/rbot/irc.rb @@ -21,6 +21,19 @@ require 'singleton' +# The following monkeypatch is to fix a bug in Singleton where marshaling would +# fail when trying to restore a marshaled Singleton due to _load being declared +# private. +module ::Singleton + public :_dump +end + +class << Singleton + module SingletonClassMethods + public :_load + end +end + class Object # We extend the Object class with a method that -- cgit v1.2.3