Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
1ef8c60d
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,发现更多精彩内容 >>
提交
1ef8c60d
编写于
2月 27, 2020
作者:
R
Ryuta Kamizono
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Avoid extra string allocation in the methods generated by eval
上级
d5be4f1a
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
16 addition
and
7 deletion
+16
-7
actionpack/lib/abstract_controller/helpers.rb
actionpack/lib/abstract_controller/helpers.rb
+4
-4
actionpack/lib/action_dispatch/http/request.rb
actionpack/lib/action_dispatch/http/request.rb
+2
-1
actionpack/lib/action_dispatch/journey/route.rb
actionpack/lib/action_dispatch/journey/route.rb
+1
-0
actionpack/lib/action_dispatch/routing/polymorphic_routes.rb
actionpack/lib/action_dispatch/routing/polymorphic_routes.rb
+1
-0
actionview/lib/action_view/helpers/form_helper.rb
actionview/lib/action_view/helpers/form_helper.rb
+1
-1
actionview/lib/action_view/layouts.rb
actionview/lib/action_view/layouts.rb
+1
-0
activemodel/lib/active_model/attribute_methods.rb
activemodel/lib/active_model/attribute_methods.rb
+1
-1
activemodel/lib/active_model/attributes.rb
activemodel/lib/active_model/attributes.rb
+1
-0
activerecord/lib/active_record/attribute_methods/read.rb
activerecord/lib/active_record/attribute_methods/read.rb
+1
-0
activerecord/lib/active_record/attribute_methods/write.rb
activerecord/lib/active_record/attribute_methods/write.rb
+1
-0
activestorage/lib/active_storage/attached/model.rb
activestorage/lib/active_storage/attached/model.rb
+2
-0
未找到文件。
actionpack/lib/abstract_controller/helpers.rb
浏览文件 @
1ef8c60d
...
...
@@ -66,10 +66,10 @@ def helper_method(*methods)
methods
.
each
do
|
method
|
_helpers
.
class_eval
<<-
ruby_eval
,
file
,
line
def
#{
method
}
(*args, &bl
k) # def current_user(*args, &bl
k)
controller.send(
%(
#{
method
}
), *args, &blk) # controller.send(:current_user, *args, &bl
k)
end # end
ruby2_keywords(
%(
#{
method
}
)
) if respond_to?(:ruby2_keywords, true)
def
#{
method
}
(*args, &bl
ock) # def current_user(*args, &bloc
k)
controller.send(
:'
#{
method
}
', *args, &block) # controller.send(:'current_user', *args, &bloc
k)
end
# end
ruby2_keywords(
:'
#{
method
}
'
) if respond_to?(:ruby2_keywords, true)
ruby_eval
end
end
...
...
actionpack/lib/action_dispatch/http/request.rb
浏览文件 @
1ef8c60d
...
...
@@ -49,8 +49,9 @@ class Request
# See https://github.com/rack/rack/commit/c173b188d81ee437b588c1e046a1c9f031dea550
ENV_METHODS
.
each
do
|
env
|
class_eval
<<-
METHOD
,
__FILE__
,
__LINE__
+
1
# frozen_string_literal: true
def
#{
env
.
sub
(
/^HTTP_/n
,
''
).
downcase
}
# def accept_charset
get_header "
#{
env
}
"
.freeze # get_header "HTTP_ACCEPT_CHARSET".freeze
get_header "
#{
env
}
"
# get_header "HTTP_ACCEPT_CHARSET"
end # end
METHOD
end
...
...
actionpack/lib/action_dispatch/journey/route.rb
浏览文件 @
1ef8c60d
...
...
@@ -13,6 +13,7 @@ module VerbMatchers
VERBS
=
%w{ DELETE GET HEAD OPTIONS LINK PATCH POST PUT TRACE UNLINK }
VERBS
.
each
do
|
v
|
class_eval
<<-
eoc
,
__FILE__
,
__LINE__
+
1
# frozen_string_literal: true
class
#{
v
}
def self.verb; name.split("::").last; end
def self.call(req); req.
#{
v
.
downcase
}
?; end
...
...
actionpack/lib/action_dispatch/routing/polymorphic_routes.rb
浏览文件 @
1ef8c60d
...
...
@@ -145,6 +145,7 @@ def polymorphic_path(record_or_hash_or_array, options = {})
%w(edit new)
.
each
do
|
action
|
module_eval
<<-
EOT
,
__FILE__
,
__LINE__
+
1
# frozen_string_literal: true
def
#{
action
}
_polymorphic_url(record_or_hash, options = {})
polymorphic_url_for_action("
#{
action
}
", record_or_hash, options)
end
...
...
actionview/lib/action_view/helpers/form_helper.rb
浏览文件 @
1ef8c60d
...
...
@@ -1905,7 +1905,7 @@ def initialize(object_name, object, template, options)
class_eval
<<-
RUBY_EVAL
,
__FILE__
,
__LINE__
+
1
def
#{
selector
}
(method, options = {}) # def text_field(method, options = {})
@template.send( # @template.send(
#{
selector
.
inspect
}
, #
"text_field"
,
#{
selector
.
inspect
}
, #
:text_field
,
@object_name, # @object_name,
method, # method,
objectify_options(options)) # objectify_options(options))
...
...
actionview/lib/action_view/layouts.rb
浏览文件 @
1ef8c60d
...
...
@@ -321,6 +321,7 @@ def _write_layout_method # :nodoc:
end
class_eval
<<-
RUBY
,
__FILE__
,
__LINE__
+
1
# frozen_string_literal: true
def _layout(lookup_context, formats)
if _conditional_layout?
#{
layout_definition
}
...
...
activemodel/lib/active_model/attribute_methods.rb
浏览文件 @
1ef8c60d
...
...
@@ -495,7 +495,7 @@ module AttrNames # :nodoc:
def
self
.
define_attribute_accessor_method
(
mod
,
attr_name
,
writer:
false
)
method_name
=
"
#{
attr_name
}#{
'='
if
writer
}
"
if
attr_name
.
ascii_only?
&&
DEF_SAFE_NAME
.
match?
(
attr_name
)
yield
method_name
,
"'
#{
attr_name
}
'
.freeze
"
yield
method_name
,
"'
#{
attr_name
}
'"
else
safe_name
=
attr_name
.
unpack1
(
"h*"
)
const_name
=
"ATTR_
#{
safe_name
}
"
...
...
activemodel/lib/active_model/attributes.rb
浏览文件 @
1ef8c60d
...
...
@@ -47,6 +47,7 @@ def define_method_attribute=(name)
generated_attribute_methods
,
name
,
writer:
true
,
)
do
|
temp_method_name
,
attr_name_expr
|
generated_attribute_methods
.
module_eval
<<-
RUBY
,
__FILE__
,
__LINE__
+
1
# frozen_string_literal: true
def
#{
temp_method_name
}
(value)
name =
#{
attr_name_expr
}
write_attribute(name, value)
...
...
activerecord/lib/active_record/attribute_methods/read.rb
浏览文件 @
1ef8c60d
...
...
@@ -12,6 +12,7 @@ def define_method_attribute(name)
generated_attribute_methods
,
name
)
do
|
temp_method_name
,
attr_name_expr
|
generated_attribute_methods
.
module_eval
<<-
RUBY
,
__FILE__
,
__LINE__
+
1
# frozen_string_literal: true
def
#{
temp_method_name
}
name =
#{
attr_name_expr
}
_read_attribute(name) { |n| missing_attribute(n, caller) }
...
...
activerecord/lib/active_record/attribute_methods/write.rb
浏览文件 @
1ef8c60d
...
...
@@ -16,6 +16,7 @@ def define_method_attribute=(name)
generated_attribute_methods
,
name
,
writer:
true
,
)
do
|
temp_method_name
,
attr_name_expr
|
generated_attribute_methods
.
module_eval
<<-
RUBY
,
__FILE__
,
__LINE__
+
1
# frozen_string_literal: true
def
#{
temp_method_name
}
(value)
name =
#{
attr_name_expr
}
_write_attribute(name, value)
...
...
activestorage/lib/active_storage/attached/model.rb
浏览文件 @
1ef8c60d
...
...
@@ -44,6 +44,7 @@ def has_one_attached(name, dependent: :purge_later, service: nil)
validate_service_configuration
(
name
,
service
)
generated_association_methods
.
class_eval
<<-
CODE
,
__FILE__
,
__LINE__
+
1
# frozen_string_literal: true
def
#{
name
}
@active_storage_attached_
#{
name
}
||= ActiveStorage::Attached::One.new("
#{
name
}
", self)
end
...
...
@@ -113,6 +114,7 @@ def has_many_attached(name, dependent: :purge_later, service: nil)
validate_service_configuration
(
name
,
service
)
generated_association_methods
.
class_eval
<<-
CODE
,
__FILE__
,
__LINE__
+
1
# frozen_string_literal: true
def
#{
name
}
@active_storage_attached_
#{
name
}
||= ActiveStorage::Attached::Many.new("
#{
name
}
", self)
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录