Class: Zip::ZipEntrySet
- Includes:
- Enumerable
- Defined in:
- lib/ruby_archive/handlers/rubyzip/zip/zip.rb
Overview
:nodoc:all
Instance Method Summary collapse
- #<<(entry) ⇒ Object (also: #push)
- #==(other) ⇒ Object
- #delete(entry) ⇒ Object
-
#dup ⇒ Object
deep clone.
- #each(&aProc) ⇒ Object
- #entries ⇒ Object
- #glob(pattern, flags = File::FNM_PATHNAME|File::FNM_DOTMATCH) ⇒ Object
- #include?(entry) ⇒ Boolean
-
#initialize(anEnumerable = []) ⇒ ZipEntrySet
constructor
A new instance of ZipEntrySet.
- #parent(entry) ⇒ Object
- #size ⇒ Object (also: #length)
Methods included from Enumerable
Constructor Details
#initialize(anEnumerable = []) ⇒ ZipEntrySet
Returns a new instance of ZipEntrySet.
1129 1130 1131 1132 1133 |
# File 'lib/ruby_archive/handlers/rubyzip/zip/zip.rb', line 1129 def initialize(anEnumerable = []) super() @entrySet = {} anEnumerable.each { |o| push(o) } end |
Instance Method Details
#<<(entry) ⇒ Object Also known as: push
1139 1140 1141 |
# File 'lib/ruby_archive/handlers/rubyzip/zip/zip.rb', line 1139 def <<(entry) @entrySet[entry.to_s] = entry end |
#==(other) ⇒ Object
1166 1167 1168 1169 |
# File 'lib/ruby_archive/handlers/rubyzip/zip/zip.rb', line 1166 def == (other) return false unless other.kind_of?(ZipEntrySet) return @entrySet == other.entrySet end |
#delete(entry) ⇒ Object
1149 1150 1151 |
# File 'lib/ruby_archive/handlers/rubyzip/zip/zip.rb', line 1149 def delete(entry) @entrySet.delete(entry.to_s) ? entry : nil end |
#dup ⇒ Object
deep clone
1162 1163 1164 |
# File 'lib/ruby_archive/handlers/rubyzip/zip/zip.rb', line 1162 def dup newZipEntrySet = ZipEntrySet.new(@entrySet.values.map { |e| e.dup }) end |
#each(&aProc) ⇒ Object
1153 1154 1155 |
# File 'lib/ruby_archive/handlers/rubyzip/zip/zip.rb', line 1153 def each(&aProc) @entrySet.values.each(&aProc) end |
#entries ⇒ Object
1157 1158 1159 |
# File 'lib/ruby_archive/handlers/rubyzip/zip/zip.rb', line 1157 def entries @entrySet.values end |
#glob(pattern, flags = File::FNM_PATHNAME|File::FNM_DOTMATCH) ⇒ Object
1175 1176 1177 1178 1179 1180 |
# File 'lib/ruby_archive/handlers/rubyzip/zip/zip.rb', line 1175 def glob(pattern, flags = File::FNM_PATHNAME|File::FNM_DOTMATCH) entries.select { |entry| File.fnmatch(pattern, entry.name.chomp('/'), flags) } end |
#include?(entry) ⇒ Boolean
1135 1136 1137 |
# File 'lib/ruby_archive/handlers/rubyzip/zip/zip.rb', line 1135 def include?(entry) @entrySet.include?(entry.to_s) end |
#parent(entry) ⇒ Object
1171 1172 1173 |
# File 'lib/ruby_archive/handlers/rubyzip/zip/zip.rb', line 1171 def parent(entry) @entrySet[entry.parent_as_string] end |
#size ⇒ Object Also known as: length
1144 1145 1146 |
# File 'lib/ruby_archive/handlers/rubyzip/zip/zip.rb', line 1144 def size @entrySet.size end |