Permalink
Browse files

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

…to_xs demands
  • Loading branch information...
jeremy committed Mar 21, 2009
1 parent dd15a3f commit a970e32c91848a720825302eebae4d4ca7f290fa
@@ -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
@@ -6,7 +6,6 @@
rescue Gem::LoadError
$:.unshift "#{File.dirname(__FILE__)}/vendor/builder-2.1.2"
end
-require 'builder'
begin
gem 'memcache-client', '>= 1.6.5'
@@ -1,5 +1,4 @@
require 'abstract_unit'
-require 'builder'
class HashExtTest < Test::Unit::TestCase
def setup

0 comments on commit a970e32

Please sign in to comment.