I have a method that performs an XML validation against an XML Schema. If the file is valid, the method returns true
. If not, it returns false
.
I want to log results of the failed validation. I store the messages in an array, but I can't just return the array as it will evaluate to true
also.
It seems sloppy to do this:
results = MyClass.valid_file?(filenaem) if results==true # do something else # log "results" end
I wonder if there is some sort of programming pattern that is a superior solution.
Aucun commentaire:
Enregistrer un commentaire