Class: Zip::ZipEntrySet
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.
1097 1098 1099 1100 1101 |
# File 'lib/zip/zip.rb', line 1097 def initialize(anEnumerable = []) super() @entrySet = {} anEnumerable.each { |o| push(o) } end |
Instance Method Details
#<<(entry) ⇒ Object Also known as: push
1107 1108 1109 |
# File 'lib/zip/zip.rb', line 1107 def <<(entry) @entrySet[entry.to_s] = entry end |
#==(other) ⇒ Object
1134 1135 1136 1137 |
# File 'lib/zip/zip.rb', line 1134 def == (other) return false unless other.kind_of?(ZipEntrySet) return @entrySet == other.entrySet end |
#delete(entry) ⇒ Object
1117 1118 1119 |
# File 'lib/zip/zip.rb', line 1117 def delete(entry) @entrySet.delete(entry.to_s) ? entry : nil end |
#dup ⇒ Object
deep clone
1130 1131 1132 |
# File 'lib/zip/zip.rb', line 1130 def dup newZipEntrySet = ZipEntrySet.new(@entrySet.values.map { |e| e.dup }) end |
#each(&aProc) ⇒ Object
1121 1122 1123 |
# File 'lib/zip/zip.rb', line 1121 def each(&aProc) @entrySet.values.each(&aProc) end |
#entries ⇒ Object
1125 1126 1127 |
# File 'lib/zip/zip.rb', line 1125 def entries @entrySet.values end |
#glob(pattern, flags = File::FNM_PATHNAME|File::FNM_DOTMATCH) ⇒ Object
1143 1144 1145 1146 1147 1148 |
# File 'lib/zip/zip.rb', line 1143 def glob(pattern, flags = File::FNM_PATHNAME|File::FNM_DOTMATCH) entries.select { |entry| File.fnmatch(pattern, entry.name.chomp('/'), flags) } end |
#include?(entry) ⇒ Boolean
1103 1104 1105 |
# File 'lib/zip/zip.rb', line 1103 def include?(entry) @entrySet.include?(entry.to_s) end |
#parent(entry) ⇒ Object
1139 1140 1141 |
# File 'lib/zip/zip.rb', line 1139 def parent(entry) @entrySet[entry.parent_as_string] end |
#size ⇒ Object Also known as: length
1112 1113 1114 |
# File 'lib/zip/zip.rb', line 1112 def size @entrySet.size end |