commit 1b2ec087af0fea5400176b3d2a1aba42ef2bb71e
parent 3f9d7d9d5aa23786a70b8a442ac0a98fe53512d0
Author: Ben Walton <bwalton@artsci.utoronto.ca>
Date: Wed, 9 Jun 2010 22:27:44 -0400
Conditionally add Symbol#to_proc
Add a utility monkey-patch for versions of ruby that don't have the
to_proc method for Symbols.
Signed-off-by: Ben Walton
Diffstat:
1 file changed, 8 insertions(+), 0 deletions(-)
diff --git a/lib/sup/util.rb b/lib/sup/util.rb
@@ -6,6 +6,14 @@ require 'set'
require 'enumerator'
## time for some monkeypatching!
+class Symbol
+ unless method_defined? :to_proc
+ def to_proc
+ proc { |obj, *args| obj.send(self, *args) }
+ end
+ end
+end
+
class Lockfile
def gen_lock_id
Hash[