class ZipContainer::Dir

This class represents a ZipContainer in directory format. See the OCF and UCF specifications for more details.

This class provides most of the facilities of the standard ::Dir class. Please also consult the ruby Dir documentation alongside these pages.

There are code examples available with the source code of this library.

Public Class Methods

create(pathname, mimetype) → document click to toggle source
create(pathname, mimetype) {|document| ...}

Create a new (or convert an existing) directory as a ZipContainer with the specified mimetype.

# File lib/zip-container/dir.rb, line 68
def self.create(pathname, mimetype, &block)
  ::Dir.mkdir(pathname) unless ::File.directory?(pathname)
  ::File.write(full_path(MIMETYPE_FILE), mimetype)

  # Now open the newly created container.
  c = new(pathname)

  if block_given?
    begin
      yield c
    ensure
      c.close
    end
  end

  c
end

Public Instance Methods

close → nil click to toggle source

Equal to ::Dir.close

# File lib/zip-container/dir.rb, line 125
    
each { |filename| ... } → dir click to toggle source
each → an_enumerator

Equal to ::Dir.each

# File lib/zip-container/dir.rb, line 134
    
path → string or nil click to toggle source

Equal to ::Dir.path

# File lib/zip-container/dir.rb, line 142
    
pos → integer click to toggle source

Equal to ::Dir.pos

# File lib/zip-container/dir.rb, line 150
    
pos = integer → integer click to toggle source

Equal to ::Dir.pos=

# File lib/zip-container/dir.rb, line 158
    
read → string or nil click to toggle source

Equal to ::Dir.read

# File lib/zip-container/dir.rb, line 166
    
rewind → dir click to toggle source

Equal to ::Dir.rewind

# File lib/zip-container/dir.rb, line 174
    
seek(integer) → dir click to toggle source

Equal to ::Dir.seek

# File lib/zip-container/dir.rb, line 182
    
tell → integer click to toggle source

Equal to ::Dir.tell

# File lib/zip-container/dir.rb, line 190