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.
1104 1105 1106 1107 1108 |
# File 'lib/zip/zip.rb', line 1104 def initialize(anEnumerable = []) super() @entrySet = {} anEnumerable.each { |o| push(o) } end |
Instance Method Details
#<<(entry) ⇒ Object Also known as: push
1114 1115 1116 |
# File 'lib/zip/zip.rb', line 1114 def <<(entry) @entrySet[entry.to_s] = entry end |
#==(other) ⇒ Object
1141 1142 1143 1144 |
# File 'lib/zip/zip.rb', line 1141 def == (other) return false unless other.kind_of?(ZipEntrySet) return @entrySet == other.entrySet end |
#delete(entry) ⇒ Object
1124 1125 1126 |
# File 'lib/zip/zip.rb', line 1124 def delete(entry) @entrySet.delete(entry.to_s) ? entry : nil end |
#dup ⇒ Object
deep clone
1137 1138 1139 |
# File 'lib/zip/zip.rb', line 1137 def dup newZipEntrySet = ZipEntrySet.new(@entrySet.values.map { |e| e.dup }) end |
#each(&aProc) ⇒ Object
1128 1129 1130 |
# File 'lib/zip/zip.rb', line 1128 def each(&aProc) @entrySet.values.each(&aProc) end |
#entries ⇒ Object
1132 1133 1134 |
# File 'lib/zip/zip.rb', line 1132 def entries @entrySet.values end |
#glob(pattern, flags = File::FNM_PATHNAME|File::FNM_DOTMATCH) ⇒ Object
1150 1151 1152 1153 1154 1155 |
# File 'lib/zip/zip.rb', line 1150 def glob(pattern, flags = File::FNM_PATHNAME|File::FNM_DOTMATCH) entries.select { |entry| File.fnmatch(pattern, entry.name.chomp('/'), flags) } end |
#include?(entry) ⇒ Boolean
1110 1111 1112 |
# File 'lib/zip/zip.rb', line 1110 def include?(entry) @entrySet.include?(entry.to_s) end |
#parent(entry) ⇒ Object
1146 1147 1148 |
# File 'lib/zip/zip.rb', line 1146 def parent(entry) @entrySet[entry.parent_as_string] end |
#size ⇒ Object Also known as: length
1119 1120 1121 |
# File 'lib/zip/zip.rb', line 1119 def size @entrySet.size end |