1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Only require builder at startup if we need to monkey with its String#to_xs demands

This commit is contained in:
Jeremy Kemper 2009-03-21 03:05:44 -07:00
parent dd15a3fee0
commit a970e32c91
3 changed files with 10 additions and 5 deletions

View file

@ -1,11 +1,18 @@
begin
# See http://bogomips.org/fast_xs/ by Eric Wong
# See http://bogomips.org/fast_xs/ by Eric Wong.
# Also included with hpricot.
require 'fast_xs'
rescue LoadError
# fast_xs extension unavailable
else
begin
require 'builder'
rescue LoadError
# builder demands the first shot at defining String#to_xs
end
class String
alias_method :original_xs, :to_xs if method_defined?(:to_xs)
alias_method :to_xs, :fast_xs
end
rescue LoadError
# fast_xs extension unavailable.
end

View file

@ -6,7 +6,6 @@ begin
rescue Gem::LoadError
$:.unshift "#{File.dirname(__FILE__)}/vendor/builder-2.1.2"
end
require 'builder'
begin
gem 'memcache-client', '>= 1.6.5'

View file

@ -1,5 +1,4 @@
require 'abstract_unit'
require 'builder'
class HashExtTest < Test::Unit::TestCase
def setup