提交 7e93e33c 编写于 作者: S Sean Griffin

rm `ActiveRecord::Type::Decorator`

It only existed to make sure the subclasses of `Delegator` were YAML
serializable. As of Ruby 2.2, these are YAML dumpable by default, as it
includes
https://github.com/tenderlove/psych/commit/2a4d9568f7d5d19c00231cf48eb855cc45ec3394
上级 631707a5
......@@ -2,8 +2,6 @@ module ActiveRecord
module AttributeMethods
module TimeZoneConversion
class TimeZoneConverter < DelegateClass(Type::Value) # :nodoc:
include Type::Decorator
def type_cast_from_database(value)
convert_time_to_time_zone(super)
end
......
require 'active_record/type/helpers'
require 'active_record/type/decorator'
require 'active_record/type/mutable'
require 'active_record/type/numeric'
require 'active_record/type/time_value'
......
module ActiveRecord
module Type
module Decorator # :nodoc:
def init_with(coder)
@subtype = coder['subtype']
__setobj__(@subtype)
end
def encode_with(coder)
coder['subtype'] = __getobj__
end
end
end
end
......@@ -2,7 +2,6 @@ module ActiveRecord
module Type
class Serialized < DelegateClass(Type::Value) # :nodoc:
include Mutable
include Decorator
attr_reader :subtype, :coder
......@@ -36,16 +35,6 @@ def accessor
ActiveRecord::Store::IndifferentHashAccessor
end
def init_with(coder)
@coder = coder['coder']
super
end
def encode_with(coder)
coder['coder'] = @coder
super
end
private
def default_value?(value)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册