mardi 3 mars 2015

Unless with IF or ELSEIF from XML

I have an XML file that I am importing and am combining (concatenating) the information in the XML for both conditions as one import.



#Concat Delivery & Pickup

unless upload['delivery']['docket_delivery'].kind_of?(Array)
upload['delivery']['docket_delivery'] = [upload['delivery']['docket_delivery']]
end

allDockets = upload['delivery']['docket_delivery']

unless upload['delivery']['docket_pickup'].kind_of?(Array)
upload['delivery']['docket_pickup'] = [upload['delivery']['docket_pickup']]
end

allDockets.concat(upload['delivery']['docket_pickup'])


I need to have it work so that if the XML just has either a Delivery or just a Pickup, then it should work.


Aucun commentaire:

Enregistrer un commentaire