Class: Zip::ZipEntry
Instance Method Summary collapse
-
#contain?(*patterns) ⇒ Boolean
:call-seq: contain(patterns*) => boolean.
-
#empty? ⇒ Boolean
:call-seq: empty?() => boolean.
-
#exist? ⇒ Boolean
:call-seq: exist() => boolean.
Instance Method Details
#contain?(*patterns) ⇒ Boolean
:call-seq:
contain(patterns*) => boolean
Returns true if this ZIP file entry matches against all the arguments. An argument may be a string or regular expression.
66 67 68 69 70 |
# File 'lib/buildr/packaging/zip.rb', line 66 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 |
#empty? ⇒ Boolean
:call-seq:
empty?() => boolean
Returns true if this entry is empty.
57 58 59 |
# File 'lib/buildr/packaging/zip.rb', line 57 def empty?() Zip::ZipFile.open(zipfile) { |zip| zip.file.read(@name) }.empty? end |
#exist? ⇒ Boolean
:call-seq:
exist() => boolean
Returns true if this entry exists.
49 50 51 |
# File 'lib/buildr/packaging/zip.rb', line 49 def exist?() Zip::ZipFile.open(zipfile) { |zip| zip.file.exist?(@name) } end |