Class: Giff::Tarball
- Inherits:
-
Object
- Object
- Giff::Tarball
- Defined in:
- lib/giff/tarball.rb
Instance Attribute Summary collapse
-
#contents ⇒ Object
readonly
Returns the value of attribute contents.
Instance Method Summary collapse
-
#initialize(io, gz: false) ⇒ Tarball
constructor
A new instance of Tarball.
- #read(filename) ⇒ Object
Constructor Details
#initialize(io, gz: false) ⇒ Tarball
Returns a new instance of Tarball.
5 6 7 8 9 10 11 12 13 |
# File 'lib/giff/tarball.rb', line 5 def initialize(io, gz: false) io = Zlib::GzipReader.new(io) if gz @contents = Hash[ Archive::Tar::Minitar::Input.each_entry(io).map do |e| [e.name, e.read] end ] end |
Instance Attribute Details
#contents ⇒ Object (readonly)
Returns the value of attribute contents.
15 16 17 |
# File 'lib/giff/tarball.rb', line 15 def contents @contents end |
Instance Method Details
#read(filename) ⇒ Object
17 18 19 |
# File 'lib/giff/tarball.rb', line 17 def read(filename) contents.fetch(filename) end |