lib/zip-container/entries/file.rb in zip-container-2.2.0 vs lib/zip-container/entries/file.rb in zip-container-3.0.0

- old
+ new

@@ -1,6 +1,6 @@ -# Copyright (c) 2013 The University of Manchester, UK. +# Copyright (c) 2013-2015 The University of Manchester, UK. # # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: @@ -71,21 +71,24 @@ @validation_proc = options[:validation_proc].is_a?(Proc) ? options[:validation_proc] : nil end # :call-seq: - # verify! + # verify -> Array # # Verify this ManagedFile for correctness. The contents are validated if # required. # - # A MalformedContainerError is raised if it does not pass verification. - def verify! - super + # If it does not pass verification a list of reasons why it fails is + # returned. The empty list is returned if verification passes. + def verify + messages = super + unless (exists? ? validate : true) - raise MalformedContainerError.new("The contents of file "\ - "'#{full_name}' do not pass validation.") + messages << "The contents of file '#{full_name}' do not pass validation." end + + messages end protected # :call-seq: