Module: Enumerable

Included in:
IOExtras::AbstractInputStream, Zip::ZipCentralDirectory, Zip::ZipEntrySet, Zip::ZipFileSystem::ZipFileNameMapper, Zip::ZipFileSystem::ZipFsDirIterator
Defined in:
lib/zip/stdrubyext.rb,
lib/rwd/ruby.rb,
lib/zip/stdrubyext.rb

Overview

:nodoc:all

Instance Method Summary collapse

Instance Method Details

#deep_cloneObject



37
38
39
# File 'lib/rwd/ruby.rb', line 37

def deep_clone
  Marshal::load(Marshal::dump(clone))
end

#deep_dupObject



33
34
35
# File 'lib/rwd/ruby.rb', line 33

def deep_dup
  Marshal::load(Marshal::dump(dup))
end

#inject(n = 0) ⇒ Object



3
4
5
6
# File 'lib/zip/stdrubyext.rb', line 3

def inject(n = 0)
  each { |value| n = yield(n, value) }
  n
end

#select_map(&aProc) ⇒ Object

returns a new array of all the return values not equal to nil This implementation could be faster



13
14
15
# File 'lib/zip/stdrubyext.rb', line 13

def select_map(&aProc)
  map(&aProc).reject { |e| e.nil? }
end