# File lib/zip/zipfilesystem.rb, line 475 def foreach(aDirectoryName) unless @file.stat(aDirectoryName).directory? raise Errno::ENOTDIR, aDirectoryName end path = @file.expand_path(aDirectoryName) path << '/' unless path.end_with?('/') path = Regexp.escape(path) subDirEntriesRegex = Regexp.new("^#{path}([^/]+)$") @mappedZip.each { |fileName| match = subDirEntriesRegex.match(fileName) yield(match[1]) unless match == nil } end