Skip to content

Commit

Permalink
Only require builder at startup if we need to monkey with its String#…
Browse files Browse the repository at this point in the history
…to_xs demands
  • Loading branch information
jeremy committed Mar 21, 2009
1 parent dd15a3f commit a970e32
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
13 changes: 10 additions & 3 deletions activesupport/lib/active_support/core_ext/string/xchar.rb
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion activesupport/lib/active_support/vendor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
1 change: 0 additions & 1 deletion activesupport/test/core_ext/hash_ext_test.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
require 'abstract_unit'
require 'builder'

class HashExtTest < Test::Unit::TestCase
def setup
Expand Down

0 comments on commit a970e32

Please sign in to comment.