aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2009-04-22 09:10:14 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2009-04-22 09:10:48 -0700
commit42a06d2d6253eed3b9f4fb4edfa251c9508a2e20 (patch)
treeb842a72ac3cdd144375fb140686fff71cd69befe
parentca49299434bc764b667cd86846d892e91a150ef3 (diff)
downloadrails-42a06d2d6253eed3b9f4fb4edfa251c9508a2e20.tar.gz
rails-42a06d2d6253eed3b9f4fb4edfa251c9508a2e20.tar.bz2
rails-42a06d2d6253eed3b9f4fb4edfa251c9508a2e20.zip
stdlib autoloads were hanging on 1.9.1
-rw-r--r--activesupport/lib/active_support/core_ext/string/iterators.rb5
-rw-r--r--activesupport/lib/active_support/json/decoding.rb6
-rw-r--r--activesupport/test/json/decoding_test.rb4
3 files changed, 6 insertions, 9 deletions
diff --git a/activesupport/lib/active_support/core_ext/string/iterators.rb b/activesupport/lib/active_support/core_ext/string/iterators.rb
index 472de7bc24..2f8aa84024 100644
--- a/activesupport/lib/active_support/core_ext/string/iterators.rb
+++ b/activesupport/lib/active_support/core_ext/string/iterators.rb
@@ -1,11 +1,10 @@
unless '1.9'.respond_to?(:each_char)
- autoload :StringScanner, 'strscan' unless defined? :StringScanner
-
class String
# Yields a single-character string for each character in the string.
# When $KCODE = 'UTF8', multi-byte characters are yielded appropriately.
def each_char
- scanner, char = StringScanner.new(self), /./mu
+ require 'strscan' unless defined? ::StringScanner
+ scanner, char = ::StringScanner.new(self), /./mu
while c = scanner.scan(char)
yield c
end
diff --git a/activesupport/lib/active_support/json/decoding.rb b/activesupport/lib/active_support/json/decoding.rb
index c66500aa9c..70e9f40fc7 100644
--- a/activesupport/lib/active_support/json/decoding.rb
+++ b/activesupport/lib/active_support/json/decoding.rb
@@ -1,6 +1,3 @@
-autoload :YAML, 'yaml' unless defined? YAML
-autoload :StringScanner, 'strscan' unless defined? StringScanner
-
require 'active_support/core_ext/string/starts_ends_with'
module ActiveSupport
@@ -22,7 +19,8 @@ module ActiveSupport
# Ensure that ":" and "," are always followed by a space
def convert_json_to_yaml(json) #:nodoc:
- scanner, quoting, marks, pos, times = StringScanner.new(json), false, [], nil, []
+ require 'strscan' unless defined? ::StringScanner
+ scanner, quoting, marks, pos, times = ::StringScanner.new(json), false, [], nil, []
while scanner.scan_until(/(\\['"]|['":,\\]|\\.)/)
case char = scanner[1]
when '"', "'"
diff --git a/activesupport/test/json/decoding_test.rb b/activesupport/test/json/decoding_test.rb
index 8fe40557d6..7d8a07654d 100644
--- a/activesupport/test/json/decoding_test.rb
+++ b/activesupport/test/json/decoding_test.rb
@@ -1,7 +1,7 @@
# encoding: UTF-8
require 'abstract_unit'
-class TestJSONDecoding < Test::Unit::TestCase
+class TestJSONDecoding < ActiveSupport::TestCase
TESTS = {
%q({"returnTo":{"\/categories":"\/"}}) => {"returnTo" => {"/categories" => "/"}},
%q({returnTo:{"\/categories":"\/"}}) => {"returnTo" => {"/categories" => "/"}},
@@ -36,7 +36,7 @@ class TestJSONDecoding < Test::Unit::TestCase
}
TESTS.each do |json, expected|
- define_method :"test_json_decoding_#{json}" do
+ test "json decodes #{json}" do
assert_nothing_raised do
assert_equal expected, ActiveSupport::JSON.decode(json)
end