class Zip::Entry

Public Instance Methods

contain(patterns*) → boolean click to toggle source

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 79
def contain?(*patterns)
  content = File.open(zipfile) { |zip| zip.read(@name) }
  patterns.map { |pattern| Regexp === pattern ? pattern : Regexp.new(Regexp.escape(pattern.to_s)) }.
    all? { |pattern| content =~ pattern }
end
empty?() → boolean click to toggle source

Returns true if this entry is empty.

# File lib/buildr/packaging/zip.rb, line 70
def empty?()
  File.open(zipfile) { |zip| zip.read(@name) }.empty?
end
exist() → boolean click to toggle source

Returns true if this entry exists.

# File lib/buildr/packaging/zip.rb, line 62
def exist?()
  File.open(zipfile) { |zip| zip.exist?(@name) }
end