Class: Rant::Archive::Rubyzip::ZipEntrySet

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/rant/archive/rubyzip.rb

Overview

:nodoc:all

Instance Method Summary collapse

Methods included from Enumerable

#inject, #select_map

Constructor Details

#initialize(anEnumerable = []) ⇒ ZipEntrySet

Returns a new instance of ZipEntrySet.


795
796
797
798
799
# File 'lib/rant/archive/rubyzip.rb', line 795

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

Instance Method Details

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


805
806
807
# File 'lib/rant/archive/rubyzip.rb', line 805

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

#==(other) ⇒ Object


832
833
834
835
# File 'lib/rant/archive/rubyzip.rb', line 832

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

#delete(entry) ⇒ Object


815
816
817
# File 'lib/rant/archive/rubyzip.rb', line 815

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

#dupObject

deep clone


828
829
830
# File 'lib/rant/archive/rubyzip.rb', line 828

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

#each(&aProc) ⇒ Object


819
820
821
# File 'lib/rant/archive/rubyzip.rb', line 819

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

#entriesObject


823
824
825
# File 'lib/rant/archive/rubyzip.rb', line 823

def entries
  @entrySet.values
end

#include?(entry) ⇒ Boolean

Returns:

  • (Boolean)

801
802
803
# File 'lib/rant/archive/rubyzip.rb', line 801

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

#parent(entry) ⇒ Object


837
838
839
# File 'lib/rant/archive/rubyzip.rb', line 837

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

#sizeObject Also known as: length


810
811
812
# File 'lib/rant/archive/rubyzip.rb', line 810

def size
  @entrySet.size
end