提交 c4809d99 编写于 作者: S Santiago Pastorino

use map instead of each

上级 3ab98cf6
......@@ -1500,9 +1500,7 @@ def attributes=(new_attributes, guard_protected_attributes = true)
# Returns a hash of all the attributes with their names as keys and the values of the attributes as values.
def attributes
attrs = {}
attribute_names.each { |name| attrs[name] = read_attribute(name) }
attrs
Hash[attribute_names.map { |name| [name, read_attribute(name)] }]
end
# Returns an <tt>#inspect</tt>-like string for the value of the
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册