Class: Zip::ZipFileSystem::ZipFileNameMapper
- Inherits:
-
Object
- Object
- Zip::ZipFileSystem::ZipFileNameMapper
- Includes:
- Enumerable
- Defined in:
- lib/zip/zipfilesystem.rb
Overview
All access to ZipFile from ZipFsFile and ZipFsDir goes through a ZipFileNameMapper, which has one responsibility: ensure
Instance Attribute Summary (collapse)
-
- (Object) pwd
Returns the value of attribute pwd.
Instance Method Summary (collapse)
-
- (Object) each
Turns entries into strings and adds leading / and removes trailing slash on directories.
- - (Object) expand_path(aPath)
- - (Object) find_entry(fileName)
- - (Object) get_entry(fileName)
- - (Object) get_input_stream(fileName, &aProc)
- - (Object) get_output_stream(fileName, &aProc)
-
- (ZipFileNameMapper) initialize(zipFile)
constructor
A new instance of ZipFileNameMapper.
- - (Object) mkdir(fileName, permissionInt = 0755)
- - (Object) read(fileName)
- - (Object) remove(fileName)
- - (Object) rename(fileName, newName, &continueOnExistsProc)
Methods included from Enumerable
Constructor Details
- (ZipFileNameMapper) initialize(zipFile)
A new instance of ZipFileNameMapper
538 539 540 541 |
# File 'lib/zip/zipfilesystem.rb', line 538 def initialize(zipFile) @zipFile = zipFile @pwd = "/" end |
Instance Attribute Details
- (Object) pwd
Returns the value of attribute pwd
543 544 545 |
# File 'lib/zip/zipfilesystem.rb', line 543 def pwd @pwd end |
Instance Method Details
- (Object) each
Turns entries into strings and adds leading / and removes trailing slash on directories
580 581 582 583 584 585 |
# File 'lib/zip/zipfilesystem.rb', line 580 def each @zipFile.each { |e| yield("/"+e.to_s.chomp("/")) } end |
- (Object) expand_path(aPath)
587 588 589 590 591 592 |
# File 'lib/zip/zipfilesystem.rb', line 587 def (aPath) = aPath.starts_with("/") ? aPath : @pwd.ensure_end("/") + aPath .gsub!(/\/\.(\/|$)/, "") .gsub!(/[^\/]+\/\.\.(\/|$)/, "") .empty? ? "/" : end |
- (Object) find_entry(fileName)
545 546 547 |
# File 'lib/zip/zipfilesystem.rb', line 545 def find_entry(fileName) @zipFile.find_entry((fileName)) end |
- (Object) get_entry(fileName)
549 550 551 |
# File 'lib/zip/zipfilesystem.rb', line 549 def get_entry(fileName) @zipFile.get_entry((fileName)) end |
- (Object) get_input_stream(fileName, &aProc)
553 554 555 |
# File 'lib/zip/zipfilesystem.rb', line 553 def get_input_stream(fileName, &aProc) @zipFile.get_input_stream((fileName), &aProc) end |
- (Object) get_output_stream(fileName, &aProc)
557 558 559 |
# File 'lib/zip/zipfilesystem.rb', line 557 def get_output_stream(fileName, &aProc) @zipFile.get_output_stream((fileName), &aProc) end |
- (Object) mkdir(fileName, permissionInt = 0755)
574 575 576 |
# File 'lib/zip/zipfilesystem.rb', line 574 def mkdir(fileName, = 0755) @zipFile.mkdir((fileName), ) end |
- (Object) read(fileName)
561 562 563 |
# File 'lib/zip/zipfilesystem.rb', line 561 def read(fileName) @zipFile.read((fileName)) end |
- (Object) remove(fileName)
565 566 567 |
# File 'lib/zip/zipfilesystem.rb', line 565 def remove(fileName) @zipFile.remove((fileName)) end |
- (Object) rename(fileName, newName, &continueOnExistsProc)
569 570 571 572 |
# File 'lib/zip/zipfilesystem.rb', line 569 def rename(fileName, newName, &continueOnExistsProc) @zipFile.rename((fileName), (newName), &continueOnExistsProc) end |