Created
December 29, 2009 07:13
-
-
Save hannahwhy/265192 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| From 3113c02569fd546ab0876890c5cfbb6a09808145 Mon Sep 17 00:00:00 2001 | |
| From: David Yip <[email protected]> | |
| Date: Tue, 29 Dec 2009 01:01:30 -0600 | |
| Subject: [PATCH] Compatibility fix for block arity changes in Ruby 1.9. | |
| The behavior of #call on lambdas and procs is now different: | |
| > Proc.new { }.call(self) | |
| => nil | |
| > lambda { }.call(self) | |
| ArgumentError: wrong number of arguments (1 for 0) | |
| This patch adjusts BlockValueContainer to compensate. For more | |
| information, see http://eigenclass.org/hiki.rb?Changes+in+Ruby+1.9#l45 | |
| and associated links. | |
| --- | |
| init.rb | 6 +++++- | |
| 1 files changed, 5 insertions(+), 1 deletions(-) | |
| diff --git a/init.rb b/init.rb | |
| index 8185e78..c7afba9 100644 | |
| --- a/init.rb | |
| +++ b/init.rb | |
| @@ -35,7 +35,11 @@ module DefaultValueForPlugin | |
| end | |
| def evaluate(instance) | |
| - return @block.call(instance) | |
| + if @block.lambda? | |
| + @block.call | |
| + else | |
| + @block.call(instance) | |
| + end | |
| end | |
| end | |
| -- | |
| 1.6.3.3 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment