Class: AndFeathers::Tarball::File
- Inherits:
-
Object
- Object
- AndFeathers::Tarball::File
- Includes:
- Enumerable
- Defined in:
- lib/and_feathers/tarball/file.rb
Overview
Represents a File inside the tarball
Instance Attribute Summary collapse
-
#mode ⇒ Fixnum
readonly
The directory mode.
-
#name ⇒ String
readonly
The directory name.
Instance Method Summary collapse
-
#each {|file| ... } ⇒ Object
Enumerableinterface which simply yields thisFileto the block. -
#initialize(name, mode, content, parent) ⇒ File
constructor
Creates a new
File. -
#path ⇒ String
This
File‘s path. -
#read ⇒ Object
This
File‘s contents.
Constructor Details
#initialize(name, mode, content, parent) ⇒ File
Creates a new File
27 28 29 30 31 32 |
# File 'lib/and_feathers/tarball/file.rb', line 27 def initialize(name, mode, content, parent) @name = name @mode = mode @content = content @parent = parent end |
Instance Attribute Details
#mode ⇒ Fixnum (readonly)
Returns the directory mode.
11 12 13 |
# File 'lib/and_feathers/tarball/file.rb', line 11 def mode @mode end |
#name ⇒ String (readonly)
Returns the directory name.
11 12 13 |
# File 'lib/and_feathers/tarball/file.rb', line 11 def name @name end |
Instance Method Details
#each {|file| ... } ⇒ Object
Enumerable interface which simply yields this File to the block
55 56 57 |
# File 'lib/and_feathers/tarball/file.rb', line 55 def each(&block) block.call(self) end |
#path ⇒ String
This File‘s path
39 40 41 |
# File 'lib/and_feathers/tarball/file.rb', line 39 def path ::File.join(@parent.path, name) end |
#read ⇒ Object
This File‘s contents
46 47 48 |
# File 'lib/and_feathers/tarball/file.rb', line 46 def read @content.call end |