Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
42a06d2d
R
rails
项目概览
张重言
/
rails
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rails
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
42a06d2d
编写于
4月 22, 2009
作者:
J
Jeremy Kemper
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
stdlib autoloads were hanging on 1.9.1
上级
ca492994
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
6 addition
and
9 deletion
+6
-9
activesupport/lib/active_support/core_ext/string/iterators.rb
...vesupport/lib/active_support/core_ext/string/iterators.rb
+2
-3
activesupport/lib/active_support/json/decoding.rb
activesupport/lib/active_support/json/decoding.rb
+2
-4
activesupport/test/json/decoding_test.rb
activesupport/test/json/decoding_test.rb
+2
-2
未找到文件。
activesupport/lib/active_support/core_ext/string/iterators.rb
浏览文件 @
42a06d2d
unless
'1.9'
.
respond_to?
(
:each_char
)
unless
'1.9'
.
respond_to?
(
:each_char
)
autoload
:StringScanner
,
'strscan'
unless
defined?
:StringScanner
class
String
class
String
# Yields a single-character string for each character in the string.
# Yields a single-character string for each character in the string.
# When $KCODE = 'UTF8', multi-byte characters are yielded appropriately.
# When $KCODE = 'UTF8', multi-byte characters are yielded appropriately.
def
each_char
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
)
while
c
=
scanner
.
scan
(
char
)
yield
c
yield
c
end
end
...
...
activesupport/lib/active_support/json/decoding.rb
浏览文件 @
42a06d2d
autoload
:YAML
,
'yaml'
unless
defined?
YAML
autoload
:StringScanner
,
'strscan'
unless
defined?
StringScanner
require
'active_support/core_ext/string/starts_ends_with'
require
'active_support/core_ext/string/starts_ends_with'
module
ActiveSupport
module
ActiveSupport
...
@@ -22,7 +19,8 @@ def decode(json)
...
@@ -22,7 +19,8 @@ def decode(json)
# Ensure that ":" and "," are always followed by a space
# Ensure that ":" and "," are always followed by a space
def
convert_json_to_yaml
(
json
)
#:nodoc:
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
(
/(\\['"]|['":,\\]|\\.)/
)
while
scanner
.
scan_until
(
/(\\['"]|['":,\\]|\\.)/
)
case
char
=
scanner
[
1
]
case
char
=
scanner
[
1
]
when
'"'
,
"'"
when
'"'
,
"'"
...
...
activesupport/test/json/decoding_test.rb
浏览文件 @
42a06d2d
# encoding: UTF-8
# encoding: UTF-8
require
'abstract_unit'
require
'abstract_unit'
class
TestJSONDecoding
<
Test
::
Uni
t
::
TestCase
class
TestJSONDecoding
<
ActiveSuppor
t
::
TestCase
TESTS
=
{
TESTS
=
{
%q({"returnTo":{"\/categories":"\/"}})
=>
{
"returnTo"
=>
{
"/categories"
=>
"/"
}},
%q({"returnTo":{"\/categories":"\/"}})
=>
{
"returnTo"
=>
{
"/categories"
=>
"/"
}},
%q({returnTo:{"\/categories":"\/"}})
=>
{
"returnTo"
=>
{
"/categories"
=>
"/"
}},
%q({returnTo:{"\/categories":"\/"}})
=>
{
"returnTo"
=>
{
"/categories"
=>
"/"
}},
...
@@ -36,7 +36,7 @@ class TestJSONDecoding < Test::Unit::TestCase
...
@@ -36,7 +36,7 @@ class TestJSONDecoding < Test::Unit::TestCase
}
}
TESTS
.
each
do
|
json
,
expected
|
TESTS
.
each
do
|
json
,
expected
|
define_method
:"test_json_decoding_
#{
json
}
"
do
test
"json decodes
#{
json
}
"
do
assert_nothing_raised
do
assert_nothing_raised
do
assert_equal
expected
,
ActiveSupport
::
JSON
.
decode
(
json
)
assert_equal
expected
,
ActiveSupport
::
JSON
.
decode
(
json
)
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录