class AndFeathers::Tarball::File

Represents a File inside the tarball

Attributes

mode[R]
name[R]

Public Class Methods

new(name, mode, content, parent) click to toggle source

Creates a new File

@param name [String] the file name @param mode [Fixnum] the file mode @param content [Proc] a block which returns the file contents @param parent [Directory, Tarball] the entity which contains this file

# File lib/and_feathers/tarball/file.rb, line 27
def initialize(name, mode, content, parent)
  @name = name
  @mode = mode
  @content = content
  @parent = parent
end

Public Instance Methods

each(&block) click to toggle source

Enumerable interface which simply yields this File to the block

@yieldparam file [File]

# File lib/and_feathers/tarball/file.rb, line 55
def each(&block)
  block.call(self)
end
path() click to toggle source

This File‘s path

@return [String]

# File lib/and_feathers/tarball/file.rb, line 39
def path
  ::File.join(@parent.path, name)
end
read() click to toggle source

This File‘s contents

# File lib/and_feathers/tarball/file.rb, line 46
def read
  @content.call
end