Sha256: 981bef75c17d3d7f7ef882c0c5414627a3527b7391b8e9833148217578dbbd6b
Contents?: true
Size: 1.31 KB
Versions: 6
Compression:
Stored size: 1.31 KB
Contents
module Zip class ZipEntrySet #:nodoc:all include Enumerable def initialize(anEnumerable = []) super() @entrySet = {} anEnumerable.each { |o| push(o) } end def include?(entry) @entrySet.include?(entry.to_s) end def <<(entry) @entrySet[entry.to_s] = entry end alias :push :<< def size @entrySet.size end alias :length :size def delete(entry) @entrySet.delete(entry.to_s) ? entry : nil end def each(&aProc) @entrySet.values.each(&aProc) end def entries @entrySet.values end # deep clone def dup ZipEntrySet.new(@entrySet.values.map { |e| e.dup }) end def ==(other) return false unless other.kind_of?(ZipEntrySet) @entrySet == other.entrySet end def parent(entry) @entrySet[entry.parent_as_string] end def glob(pattern, flags = ::File::FNM_PATHNAME|::File::FNM_DOTMATCH) entries.select do |entry| ::File.fnmatch(pattern, entry.name.chomp('/'), flags) end end #TODO attr_accessor :auto_create_directories protected attr_accessor :entrySet end end # Copyright (C) 2002, 2003 Thomas Sondergaard # rubyzip is free software; you can redistribute it and/or # modify it under the terms of the ruby license.
Version data entries
6 entries across 6 versions & 2 rubygems