Skip to content

Instantly share code, notes, and snippets.

@bfolkens
Created June 29, 2011 02:38
Show Gist options
  • Save bfolkens/1052852 to your computer and use it in GitHub Desktop.
Save bfolkens/1052852 to your computer and use it in GitHub Desktop.
1859-argumenterror-for-toxs.patch
--- activesupport-3.1.0.rc4/lib/active_support/core_ext/string/xchar.rb 2011-06-27 13:09:24.000000000 -0500
+++ activesupport-3.1.0.rc4.patched/lib/active_support/core_ext/string/xchar.rb 2011-06-25 10:09:06.000000000 -0500
@@ -13,6 +13,13 @@
class String
alias_method :original_xs, :to_xs if method_defined?(:to_xs)
- alias_method :to_xs, :fast_xs
+
+ # to_xs expects 0 args from Builder < 3 but not >= 3, although fast_xs is 0 args
+ if instance_method(:to_xs).arity == 0
+ alias_method :to_xs, :fast_xs
+ else
+ def fast_xs_absorb_args(*args); fast_xs; end
+ alias_method :to_xs, :fast_xs_absorb_args
+ end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment