Class: Zip::ZipEntrySet

Inherits:
Object show all
Includes:
Enumerable
Defined in:
lib/zip/zip.rb

Instance Method Summary collapse

Methods included from Enumerable

#deep_clone, #deep_dup, #inject, #select_map

Constructor Details

#initialize(anEnumerable = []) ⇒ ZipEntrySet

Returns a new instance of ZipEntrySet.



685
686
687
688
689
# File 'lib/zip/zip.rb', line 685

def initialize(anEnumerable = [])
  super()
  @entrySet = {}
  anEnumerable.each { |o| push(o) }
end

Instance Method Details

#<<(entry) ⇒ Object Also known as: push



695
696
697
# File 'lib/zip/zip.rb', line 695

def <<(entry)
  @entrySet[entry.to_s] = entry
end

#==(other) ⇒ Object



722
723
724
725
# File 'lib/zip/zip.rb', line 722

def == (other)
  return false unless other.kind_of?(ZipEntrySet)
  return @entrySet == other.entrySet      
end

#delete(entry) ⇒ Object



705
706
707
# File 'lib/zip/zip.rb', line 705

def delete(entry)
  @entrySet.delete(entry.to_s) ? entry : nil
end

#dupObject

deep clone



718
719
720
# File 'lib/zip/zip.rb', line 718

def dup
  newZipEntrySet = ZipEntrySet.new(@entrySet.values.map { |e| e.dup })
end

#each(&aProc) ⇒ Object



709
710
711
# File 'lib/zip/zip.rb', line 709

def each(&aProc)
  @entrySet.values.each(&aProc)
end

#entriesObject



713
714
715
# File 'lib/zip/zip.rb', line 713

def entries
  @entrySet.values
end

#include?(entry) ⇒ Boolean

Returns:

  • (Boolean)


691
692
693
# File 'lib/zip/zip.rb', line 691

def include?(entry)
  @entrySet.include?(entry.to_s)
end

#parent(entry) ⇒ Object



727
728
729
# File 'lib/zip/zip.rb', line 727

def parent(entry)
  @entrySet[entry.parent_as_string]
end

#sizeObject Also known as: length



700
701
702
# File 'lib/zip/zip.rb', line 700

def size
  @entrySet.size
end