提交 7b86ea67 编写于 作者: J Jon Moss

Revert "[ci skip] better docs for ActiveRecord::AttributeSet::YAMLEncoder#decode"

This reverts commit 7ea502ae, per
internal discussion with @sgrif -- this is documenting the
implementation of a class that isn't intended to be public API.
上级 38270498
......@@ -7,11 +7,6 @@ def initialize(default_types)
@default_types = default_types
end
# Populate +coder+ with 'concise_attributes' using +attribute_set+.
#
# If any attribute's name matches a +default_types+ key, then the
# attribute will be cast by passing +nil+ to
# ActiveRecord::Attribute#with_type.
def encode(attribute_set, coder)
coder['concise_attributes'] = attribute_set.each_value.map do |attr|
if attr.type.equal?(default_types[attr.name])
......@@ -22,18 +17,6 @@ def encode(attribute_set, coder)
end
end
# Decode a previously encoded +coder+.
#
# +coder+ should be the result of previously encoding an Active Record
# model, using #encode.
#
# If +coder+ contains an 'attributes' key, then #decode returns the value
# under the 'attributes' key.
#
# Otherwise, #decode will build an attributes hash from the provided coder,
# using its value under 'concise_attributes', while casting any nil types
# using default_types. The resulting hash is used to return a new
# ActiveRecord::AttributeSet.
def decode(coder)
if coder['attributes']
coder['attributes']
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册