class Distillery::ROM::Path::Archive

Path from archive, binding archive and entry together.

Attributes

archive[R]

Returns the value of attribute archive @return [ROMArchive]

Public Class Methods

new(archive, entry) click to toggle source

Create a an Archive Path instance

@param archive [ROMArchive] archive instance @param entry [String] archive entry

# File lib/distillery/rom/path/archive.rb, line 37
def initialize(archive, entry)
    @archive = archive
    @entry   = entry
end
separator() click to toggle source

Get the separator used to distinguish archive file from entry

@return [String,Array]

# File lib/distillery/rom/path/archive.rb, line 27
def self.separator
    @@separator
end
separator=(sep) click to toggle source

Set the separator used to distinguish archive file from entry

@param sep [String] separator

# File lib/distillery/rom/path/archive.rb, line 18
def self.separator=(sep)
    @@separator = sep.dup.freeze
end

Public Instance Methods

basename() click to toggle source

(see ROM::Path#basename)

# File lib/distillery/rom/path/archive.rb, line 64
def basename
    ::File.basename(self.entry)
end
copy(to, length = nil, offset = 0, force: false, link: :hard) click to toggle source

(see ROM::Path#copy)

# File lib/distillery/rom/path/archive.rb, line 79
def copy(to, length = nil, offset = 0, force: false, link: :hard)
    # XXX: improve like String
    @archive.extract(@entry, to, length, offset, force: force)
end
delete!() click to toggle source

(see ROM::Path#delete!)

# File lib/distillery/rom/path/archive.rb, line 91
def delete!
    @archive.delete!(@entry)
end
entry() click to toggle source

(see ROM::Path#entry)

# File lib/distillery/rom/path/archive.rb, line 59
def entry
    @entry
end
file() click to toggle source

(see ROM::Path#file)

# File lib/distillery/rom/path/archive.rb, line 49
def file
    @archive.file
end
grouping() click to toggle source

(see ROM::Path#grouping)

# File lib/distillery/rom/path/archive.rb, line 69
def grouping
    [ self.storage, self.entry, @archive.size ]
end
reader(&block) click to toggle source

(see ROM::Path#reader)

# File lib/distillery/rom/path/archive.rb, line 74
def reader(&block)
    @archive.reader(@entry, &block)
end
rename(path, force: false) click to toggle source

(see ROM::Path#rename)

# File lib/distillery/rom/path/archive.rb, line 85
def rename(path, force: false)
    # XXX: improve like String
    @archive.rename(@entry, path, force: force)
end
storage() click to toggle source

(see ROM::Path#storage)

# File lib/distillery/rom/path/archive.rb, line 54
def storage
    self.file
end
to_s(separator = nil) click to toggle source

(see ROM::Path#to_s)

# File lib/distillery/rom/path/archive.rb, line 43
def to_s(separator = nil)
    separator ||= @@separator
    "#{self.file}#{separator[0]}#{self.entry}#{separator[1]}"
end