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 |