提交 332d6c9b 编写于 作者: S Sean Griffin

Don't mess with `_before_type_cast` for numeric types

上级 6680ee94
......@@ -5,9 +5,8 @@ module OID # :nodoc:
class Float < Type::Float
include Infinity
def type_cast(value)
def cast_value(value)
case value
when nil then nil
when 'Infinity' then ::Float::INFINITY
when '-Infinity' then -::Float::INFINITY
when 'NaN' then ::Float::NAN
......
......@@ -5,13 +5,14 @@ def number?
true
end
def type_cast_for_write(value)
case value
def type_cast(value)
value = case value
when true then 1
when false then 0
when ::String then value.presence
else super
else value
end
super(value)
end
def changed?(old_value, new_value) # :nodoc:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册