Skip to content

Commit

Permalink
String#to_xs uses the fast_xs extension if available for Builder spee…
Browse files Browse the repository at this point in the history
…dup.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7773 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
jeremy committed Oct 7, 2007
1 parent 4430a00 commit 845e6ff
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 10 deletions.
1 change: 1 addition & 0 deletions actionpack/lib/action_view/base.rb
@@ -1,4 +1,5 @@
require 'erb'
require 'builder'

class ERB
module Util
Expand Down
2 changes: 2 additions & 0 deletions activesupport/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*

* String#to_xs uses the fast_xs extension if available for Builder speedup. [Jeremy Kemper]

* Introduce BasicObject as Builder::BlankSlate for Ruby 1.9 forward compatibility. [Jeremy Kemper]

* Unbundle Builder in favor of a gem dependency. [Jeremy Kemper]
Expand Down
1 change: 1 addition & 0 deletions activesupport/Rakefile
Expand Up @@ -18,6 +18,7 @@ task :default => :test
Rake::TestTask.new { |t|
t.pattern = 'test/**/*_test.rb'
t.verbose = true
t.warning = true
}

# Create compressed packages
Expand Down
2 changes: 2 additions & 0 deletions activesupport/lib/active_support.rb
Expand Up @@ -24,6 +24,8 @@
$:.unshift(File.dirname(__FILE__))
$:.unshift(File.dirname(__FILE__) + "/active_support/vendor")

require 'rubygems'

require 'active_support/basic_object'

require 'active_support/inflector'
Expand Down
5 changes: 2 additions & 3 deletions activesupport/lib/active_support/basic_object.rb
@@ -1,6 +1,5 @@
# Ruby 1.9 introduces BasicObject. Use Builder's BlankSlate before then.
# Ruby 1.9 introduces BasicObject. Use Builder's BlankSlate until then.
unless defined? BasicObject
require 'rubygems'
require 'builder'
require 'builder/blankslate'
BasicObject = Builder::BlankSlate
end
@@ -1,3 +1,5 @@
require 'builder'

module ActiveSupport #:nodoc:
module CoreExtensions #:nodoc:
module Array #:nodoc:
Expand Down
Expand Up @@ -2,6 +2,7 @@
require 'xml_simple'
require 'cgi'
require 'base64'
require 'builder'

# Extensions needed for Hash#to_query
class Object
Expand Down
1 change: 1 addition & 0 deletions activesupport/lib/active_support/core_ext/string.rb
Expand Up @@ -4,6 +4,7 @@
require 'active_support/core_ext/string/starts_ends_with'
require 'active_support/core_ext/string/iterators' unless 'test'.respond_to?(:each_char)
require 'active_support/core_ext/string/unicode'
require 'active_support/core_ext/string/xchar'

class String #:nodoc:
include ActiveSupport::CoreExtensions::String::Access
Expand Down
10 changes: 10 additions & 0 deletions activesupport/lib/active_support/core_ext/string/xchar.rb
@@ -0,0 +1,10 @@
begin
require 'fast_xs'

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
16 changes: 9 additions & 7 deletions activesupport/test/abstract_unit.rb
Expand Up @@ -5,13 +5,15 @@
require 'active_support'

# Wrap tests that use Mocha and skip if unavailable.
def uses_mocha(test_name)
require 'rubygems'
gem 'mocha', '>= 0.5.5'
require 'mocha'
yield
rescue LoadError
$stderr.puts "Skipping #{test_name} tests. `gem install mocha` and try again."
unless defined? uses_mocha
def uses_mocha(test_name)
require 'rubygems'
gem 'mocha', '>= 0.5.5'
require 'mocha'
yield
rescue LoadError
$stderr.puts "Skipping #{test_name} tests. `gem install mocha` and try again."
end
end

# Show backtraces for deprecated behavior for quicker cleanup.
Expand Down

0 comments on commit 845e6ff

Please sign in to comment.