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