Factorize some code in Dossier#serialize_value_for_export

This commit is contained in:
gregoirenovel 2017-04-11 11:38:48 +02:00
parent ae5b4f6249
commit 1db37894c2

View file

@ -210,7 +210,7 @@ class Dossier < ActiveRecord::Base
def convert_specific_hash_values_to_string(hash_to_convert)
hash = {}
hash_to_convert.each do |key, value|
value = value.to_s if !value.kind_of?(Time) && !value.nil?
value = serialize_value_for_export(value)
hash.store(key, value)
end
return hash
@ -218,7 +218,7 @@ class Dossier < ActiveRecord::Base
def full_data_strings_array
data_with_champs.map do |value|
value.nil? || value.kind_of?(Time) ? value : value.to_s
serialize_value_for_export(value)
end
end
@ -303,4 +303,8 @@ class Dossier < ActiveRecord::Base
end
end
def serialize_value_for_export(value)
value.nil? || value.kind_of?(Time) ? value : value.to_s
end
end