Returns true if this ZIP file entry matches against all the arguments. An argument may be a string or regular expression.
# File lib/buildr/packaging/zip.rb, line 67 def contain?(*patterns) content = Zip::ZipFile.open(zipfile) { |zip| zip.file.read(@name) } patterns.map { |pattern| Regexp === pattern ? pattern : Regexp.new(Regexp.escape(pattern.to_s)) }. all? { |pattern| content =~ pattern } end
Returns true if this entry is empty.
# File lib/buildr/packaging/zip.rb, line 58 def empty?() Zip::ZipFile.open(zipfile) { |zip| zip.file.read(@name) }.empty? end
Returns true if this entry exists.
# File lib/buildr/packaging/zip.rb, line 50 def exist?() Zip::ZipFile.open(zipfile) { |zip| zip.file.exist?(@name) } end