Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
b3f3d49f
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,发现更多精彩内容 >>
提交
b3f3d49f
编写于
7月 01, 2017
作者:
K
Kir Shatrov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Prepare AP and AR to be frozen string friendly
上级
6f2b0eb4
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
37 addition
and
19 deletion
+37
-19
actionpack/lib/action_dispatch/http/request.rb
actionpack/lib/action_dispatch/http/request.rb
+1
-0
actionpack/lib/action_dispatch/http/url.rb
actionpack/lib/action_dispatch/http/url.rb
+2
-1
actionpack/lib/action_dispatch/journey/formatter.rb
actionpack/lib/action_dispatch/journey/formatter.rb
+2
-1
actionpack/lib/action_dispatch/journey/visitors.rb
actionpack/lib/action_dispatch/journey/visitors.rb
+3
-2
actionpack/lib/action_dispatch/middleware/debug_exceptions.rb
...onpack/lib/action_dispatch/middleware/debug_exceptions.rb
+2
-1
actionpack/lib/action_dispatch/middleware/ssl.rb
actionpack/lib/action_dispatch/middleware/ssl.rb
+3
-2
actionpack/lib/action_dispatch/middleware/static.rb
actionpack/lib/action_dispatch/middleware/static.rb
+2
-1
actionpack/lib/action_dispatch/routing/mapper.rb
actionpack/lib/action_dispatch/routing/mapper.rb
+2
-1
actionpack/lib/action_dispatch/routing/route_set.rb
actionpack/lib/action_dispatch/routing/route_set.rb
+2
-1
actionpack/test/abstract_unit.rb
actionpack/test/abstract_unit.rb
+2
-1
actionpack/test/controller/routing_test.rb
actionpack/test/controller/routing_test.rb
+2
-1
actionpack/test/dispatch/debug_exceptions_test.rb
actionpack/test/dispatch/debug_exceptions_test.rb
+2
-1
actionpack/test/dispatch/prefix_generation_test.rb
actionpack/test/dispatch/prefix_generation_test.rb
+2
-1
actionpack/test/dispatch/static_test.rb
actionpack/test/dispatch/static_test.rb
+3
-2
actionpack/test/journey/router/utils_test.rb
actionpack/test/journey/router/utils_test.rb
+2
-1
actionview/lib/action_view/log_subscriber.rb
actionview/lib/action_view/log_subscriber.rb
+2
-1
actionview/lib/action_view/template.rb
actionview/lib/action_view/template.rb
+1
-0
activerecord/lib/active_record/connection_adapters/postgresql/oid/money.rb
...active_record/connection_adapters/postgresql/oid/money.rb
+2
-1
未找到文件。
actionpack/lib/action_dispatch/http/request.rb
浏览文件 @
b3f3d49f
# frozen_string_literal: true
require
"stringio"
require
"active_support/inflector"
...
...
actionpack/lib/action_dispatch/http/url.rb
浏览文件 @
b3f3d49f
# frozen_string_literal: true
require
"active_support/core_ext/module/attribute_accessors"
module
ActionDispatch
...
...
@@ -155,7 +156,7 @@ def normalize_host(_host, options)
subdomain
=
options
.
fetch
:subdomain
,
true
domain
=
options
[
:domain
]
host
=
""
host
=
""
.
dup
if
subdomain
==
true
return
_host
if
domain
.
nil?
...
...
actionpack/lib/action_dispatch/journey/formatter.rb
浏览文件 @
b3f3d49f
# frozen_string_literal: true
require
"action_controller/metal/exceptions"
module
ActionDispatch
...
...
@@ -48,7 +49,7 @@ def generate(name, options, path_parameters, parameterize = nil)
unmatched_keys
=
(
missing_keys
||
[])
&
constraints
.
keys
missing_keys
=
(
missing_keys
||
[])
-
unmatched_keys
message
=
"No route matches
#{
Hash
[
constraints
.
sort_by
{
|
k
,
v
|
k
.
to_s
}
].inspect}"
message
=
"No route matches
#{
Hash
[
constraints
.
sort_by
{
|
k
,
v
|
k
.
to_s
}
].inspect}"
.
dup
message
<<
", missing required keys:
#{
missing_keys
.
sort
.
inspect
}
"
if
missing_keys
&&
!
missing_keys
.
empty?
message
<<
", possible unmatched constraints:
#{
unmatched_keys
.
sort
.
inspect
}
"
if
unmatched_keys
&&
!
unmatched_keys
.
empty?
...
...
actionpack/lib/action_dispatch/journey/visitors.rb
浏览文件 @
b3f3d49f
# frozen_string_literal: true
module
ActionDispatch
# :stopdoc:
module
Journey
...
...
@@ -175,7 +176,7 @@ def nary(node, seed)
last_child
=
node
.
children
.
last
node
.
children
.
inject
(
seed
)
{
|
s
,
c
|
string
=
visit
(
c
,
s
)
string
<<
"|"
.
freeze
unless
last_child
==
c
string
<<
"|"
unless
last_child
==
c
string
}
end
...
...
@@ -185,7 +186,7 @@ def terminal(node, seed)
end
def
visit_GROUP
(
node
,
seed
)
visit
(
node
.
left
,
seed
<<
"("
.
freeze
)
<<
")"
.
freeze
visit
(
node
.
left
,
seed
.
dup
<<
"("
)
<<
")"
end
INSTANCE
=
new
...
...
actionpack/lib/action_dispatch/middleware/debug_exceptions.rb
浏览文件 @
b3f3d49f
# frozen_string_literal: true
require_relative
"../http/request"
require_relative
"exception_wrapper"
require_relative
"../routing/inspector"
...
...
@@ -21,7 +22,7 @@ def debug_params(params)
if
clean_params
.
empty?
"None"
else
PP
.
pp
(
clean_params
,
""
,
200
)
PP
.
pp
(
clean_params
,
""
.
dup
,
200
)
end
end
...
...
actionpack/lib/action_dispatch/middleware/ssl.rb
浏览文件 @
b3f3d49f
# frozen_string_literal: true
module
ActionDispatch
# This middleware is added to the stack when `config.force_ssl = true`, and is passed
# the options set in `config.ssl_options`. It does three jobs to enforce secure HTTP
...
...
@@ -94,7 +95,7 @@ def normalize_hsts_options(options)
# http://tools.ietf.org/html/rfc6797#section-6.1
def
build_hsts_header
(
hsts
)
value
=
"max-age=
#{
hsts
[
:expires
].
to_i
}
"
value
=
"max-age=
#{
hsts
[
:expires
].
to_i
}
"
.
dup
value
<<
"; includeSubDomains"
if
hsts
[
:subdomains
]
value
<<
"; preload"
if
hsts
[
:preload
]
value
...
...
@@ -133,7 +134,7 @@ def https_location_for(request)
host
=
@redirect
[
:host
]
||
request
.
host
port
=
@redirect
[
:port
]
||
request
.
port
location
=
"https://
#{
host
}
"
location
=
"https://
#{
host
}
"
.
dup
location
<<
":
#{
port
}
"
if
port
!=
80
&&
port
!=
443
location
<<
request
.
fullpath
location
...
...
actionpack/lib/action_dispatch/middleware/static.rb
浏览文件 @
b3f3d49f
# frozen_string_literal: true
require
"rack/utils"
require
"active_support/core_ext/uri"
...
...
@@ -33,7 +34,7 @@ def match?(path)
paths
=
[
path
,
"
#{
path
}#{
ext
}
"
,
"
#{
path
}
/
#{
@index
}#{
ext
}
"
]
if
match
=
paths
.
detect
{
|
p
|
path
=
File
.
join
(
@root
,
p
.
force_encoding
(
Encoding
::
UTF_8
))
path
=
File
.
join
(
@root
,
p
.
dup
.
force_encoding
(
Encoding
::
UTF_8
))
begin
File
.
file?
(
path
)
&&
File
.
readable?
(
path
)
rescue
SystemCallError
...
...
actionpack/lib/action_dispatch/routing/mapper.rb
浏览文件 @
b3f3d49f
# frozen_string_literal: true
require
"active_support/core_ext/hash/slice"
require
"active_support/core_ext/enumerable"
require
"active_support/core_ext/array/extract_options"
...
...
@@ -306,7 +307,7 @@ def app(blocks)
def
check_controller_and_action
(
path_params
,
controller
,
action
)
hash
=
check_part
(
:controller
,
controller
,
path_params
,
{})
do
|
part
|
translate_controller
(
part
)
{
message
=
"'
#{
part
}
' is not a supported controller name. This can lead to potential routing problems."
message
=
"'
#{
part
}
' is not a supported controller name. This can lead to potential routing problems."
.
dup
message
<<
" See http://guides.rubyonrails.org/routing.html#specifying-a-controller-to-use"
raise
ArgumentError
,
message
...
...
actionpack/lib/action_dispatch/routing/route_set.rb
浏览文件 @
b3f3d49f
# frozen_string_literal: true
require_relative
"../journey"
require
"active_support/core_ext/object/to_query"
require
"active_support/core_ext/hash/slice"
...
...
@@ -233,7 +234,7 @@ def raise_generation_error(args)
missing_keys
<<
missing_key
}
constraints
=
Hash
[
@route
.
requirements
.
merge
(
params
).
sort_by
{
|
k
,
v
|
k
.
to_s
}]
message
=
"No route matches
#{
constraints
.
inspect
}
"
message
=
"No route matches
#{
constraints
.
inspect
}
"
.
dup
message
<<
", missing required keys:
#{
missing_keys
.
sort
.
inspect
}
"
raise
ActionController
::
UrlGenerationError
,
message
...
...
actionpack/test/abstract_unit.rb
浏览文件 @
b3f3d49f
# frozen_string_literal: true
$:
.
unshift
File
.
expand_path
(
"lib"
,
__dir__
)
$:
.
unshift
File
.
expand_path
(
"fixtures/helpers"
,
__dir__
)
$:
.
unshift
File
.
expand_path
(
"fixtures/alternate_helpers"
,
__dir__
)
...
...
@@ -175,7 +176,7 @@ def with_autoload_path(path)
class
Rack::TestCase
<
ActionDispatch
::
IntegrationTest
def
self
.
testing
(
klass
=
nil
)
if
klass
@testing
=
"/
#{
klass
.
name
.
underscore
}
"
.
sub
!
(
/_controller$/
,
""
)
@testing
=
"/
#{
klass
.
name
.
underscore
}
"
.
sub
(
/_controller$/
,
""
)
else
@testing
end
...
...
actionpack/test/controller/routing_test.rb
浏览文件 @
b3f3d49f
# frozen_string_literal: true
require
"abstract_unit"
require
"controller/fake_controllers"
require
"active_support/core_ext/object/with_options"
...
...
@@ -656,7 +657,7 @@ def test_route_with_text_default
assert_equal
"/page/foo"
,
url_for
(
rs
,
controller:
"content"
,
action:
"show_page"
,
id:
"foo"
)
assert_equal
({
controller:
"content"
,
action:
"show_page"
,
id:
"foo"
},
rs
.
recognize_path
(
"/page/foo"
))
token
=
"
\321\202\320\265\320\272\321\201\321\202
"
# 'text' in Russian
token
=
"
\321\202\320\265\320\272\321\201\321\202
"
.
dup
# 'text' in Russian
token
.
force_encoding
(
Encoding
::
BINARY
)
escaped_token
=
CGI
::
escape
(
token
)
...
...
actionpack/test/dispatch/debug_exceptions_test.rb
浏览文件 @
b3f3d49f
# frozen_string_literal: true
require
"abstract_unit"
class
DebugExceptionsTest
<
ActionDispatch
::
IntegrationTest
...
...
@@ -344,7 +345,7 @@ def call(env)
})
assert_response
500
assert_includes
(
body
,
CGI
.
escapeHTML
(
PP
.
pp
(
params
,
""
,
200
)))
assert_includes
(
body
,
CGI
.
escapeHTML
(
PP
.
pp
(
params
,
""
.
dup
,
200
)))
end
test
"sets the HTTP charset parameter"
do
...
...
actionpack/test/dispatch/prefix_generation_test.rb
浏览文件 @
b3f3d49f
# frozen_string_literal: true
require
"abstract_unit"
require
"rack/test"
require
"rails/engine"
...
...
@@ -11,7 +12,7 @@ def to_param
end
def
self
.
model_name
klass
=
"Post"
klass
=
"Post"
.
dup
def
klass
.
name
;
self
end
ActiveModel
::
Name
.
new
(
klass
)
...
...
actionpack/test/dispatch/static_test.rb
浏览文件 @
b3f3d49f
# frozen_string_literal: true
require
"abstract_unit"
require
"zlib"
...
...
@@ -29,7 +30,7 @@ def test_handles_urls_with_bad_encoding
end
def
test_handles_urls_with_ascii_8bit
assert_equal
"Hello, World!"
,
get
(
"/doorkeeper%E3E4"
.
force_encoding
(
"ASCII-8BIT"
)).
body
assert_equal
"Hello, World!"
,
get
(
"/doorkeeper%E3E4"
.
dup
.
force_encoding
(
"ASCII-8BIT"
)).
body
end
def
test_handles_urls_with_ascii_8bit_on_win_31j
...
...
@@ -37,7 +38,7 @@ def test_handles_urls_with_ascii_8bit_on_win_31j
Encoding
.
default_internal
=
"Windows-31J"
Encoding
.
default_external
=
"Windows-31J"
end
assert_equal
"Hello, World!"
,
get
(
"/doorkeeper%E3E4"
.
force_encoding
(
"ASCII-8BIT"
)).
body
assert_equal
"Hello, World!"
,
get
(
"/doorkeeper%E3E4"
.
dup
.
force_encoding
(
"ASCII-8BIT"
)).
body
end
def
test_handles_urls_with_null_byte
...
...
actionpack/test/journey/router/utils_test.rb
浏览文件 @
b3f3d49f
# frozen_string_literal: true
require
"abstract_unit"
module
ActionDispatch
...
...
@@ -21,7 +22,7 @@ def test_uri_unescape
end
def
test_uri_unescape_with_utf8_string
assert_equal
"Šašinková"
,
Utils
.
unescape_uri
(
"%C5%A0a%C5%A1inkov%C3%A1"
.
force_encoding
(
Encoding
::
US_ASCII
))
assert_equal
"Šašinková"
,
Utils
.
unescape_uri
(
"%C5%A0a%C5%A1inkov%C3%A1"
.
dup
.
force_encoding
(
Encoding
::
US_ASCII
))
end
def
test_normalize_path_not_greedy
...
...
actionview/lib/action_view/log_subscriber.rb
浏览文件 @
b3f3d49f
# frozen_string_literal: true
require
"active_support/log_subscriber"
module
ActionView
...
...
@@ -83,7 +84,7 @@ def cache_message(payload) # :doc:
def
log_rendering_start
(
payload
)
info
do
message
=
" Rendering
#{
from_rails_root
(
payload
[
:identifier
])
}
"
message
=
" Rendering
#{
from_rails_root
(
payload
[
:identifier
])
}
"
.
dup
message
<<
" within
#{
from_rails_root
(
payload
[
:layout
])
}
"
if
payload
[
:layout
]
message
end
...
...
actionview/lib/action_view/template.rb
浏览文件 @
b3f3d49f
# frozen_string_literal: true
require
"active_support/core_ext/object/try"
require
"active_support/core_ext/kernel/singleton_class"
require
"thread"
...
...
activerecord/lib/active_record/connection_adapters/postgresql/oid/money.rb
浏览文件 @
b3f3d49f
# frozen_string_literal: true
module
ActiveRecord
module
ConnectionAdapters
module
PostgreSQL
...
...
@@ -22,7 +23,7 @@ def cast_value(value)
# (3) -$2.55
# (4) ($2.55)
value
.
sub!
(
/^\((.+)\)$/
,
'-\1'
)
# (4)
value
=
value
.
sub
(
/^\((.+)\)$/
,
'-\1'
)
# (4)
case
value
when
/^-?\D+[\d,]+\.\d{2}$/
# (1)
value
.
gsub!
(
/[^-\d.]/
,
""
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录