Browse files

Hack builder to look for fast_xs instead of insisting on its own Stri…

  • Loading branch information...
1 parent 6de241b commit 5d3712a81e502f46b2745d238d9bb76fcdb31f5b @jeremy jeremy committed Nov 23, 2008
@@ -18,7 +18,6 @@ def self.check_for_name_collision(klass, method_name, defined_constant=nil)
if ! defined?(Builder::XChar)
- Builder.check_for_name_collision(String, "to_xs")
Builder.check_for_name_collision(Fixnum, "xchr")
@@ -105,11 +104,12 @@ def xchr
# Enhance the String class with a XML escaped character version of
# to_s.
+require 'active_support/core_ext/string/xchar'
class String
# XML escaped version of to_s
def to_xs
unpack('U*').map {|n| n.xchr}.join # ASCII, UTF-8
unpack('C*').map {|n| n.xchr}.join # ISO-8859-1, WIN-1252
- end
+ end unless method_defined?(:to_xs)
@@ -1,4 +1,5 @@
require 'abstract_unit'
+require 'builder'
class HashExtTest < Test::Unit::TestCase
def setup

3 comments on commit 5d3712a

I get Name Collision: Method 'to_xs' is already defined in String after this commit. Seems to be taking builder from the gem and not from the rails source… yep, if i uninstall the builder gem, it works fine.

/Library/Ruby/Gems/1.8/gems/builder-2.1.2/lib/builder/xchar.rb 14 in `check_for_name_collision'

Please let me know if i should post a bug report on lighthouse in these kinds of cases? seems like this is better targeted.


masterkain replied Nov 24, 2008

same as above


NZKoz replied Nov 24, 2008

Please post bug reports or drop an email to the core list

These comments often get flooded and can be quite easy for things to drop through the cracks.

Please sign in to comment.