Use if/else

Since we are using both branches of the code is preferable to use
if/else over the early return.
上级 f39595a6
......@@ -18,8 +18,11 @@ def format_date(value)
end
def datetime_value(value)
return value unless value.is_a? String
DateTime.parse(value) rescue nil
if value.is_a? String
DateTime.parse(value) rescue nil
else
value
end
end
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册