Use if/else
Since we are using both branches of the code is preferable to use if/else over the early return.
This commit is contained in:
parent
f39595a630
commit
2546610920
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user