Class: SolrWrapper::TgzExtractor
- Inherits:
-
Object
- Object
- SolrWrapper::TgzExtractor
- Defined in:
- lib/solr_wrapper/tgz_extractor.rb
Constant Summary collapse
- TAR_LONGLINK =
'././@LongLink'
Instance Attribute Summary collapse
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
Instance Method Summary collapse
- #extract! ⇒ Object
-
#initialize(file, destination: nil) ⇒ TgzExtractor
constructor
A new instance of TgzExtractor.
Constructor Details
#initialize(file, destination: nil) ⇒ TgzExtractor
Returns a new instance of TgzExtractor.
10 11 12 13 |
# File 'lib/solr_wrapper/tgz_extractor.rb', line 10 def initialize(file, destination: nil) @file = file @destination = destination || Dir.mktmpdir end |
Instance Attribute Details
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
6 7 8 |
# File 'lib/solr_wrapper/tgz_extractor.rb', line 6 def destination @destination end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
6 7 8 |
# File 'lib/solr_wrapper/tgz_extractor.rb', line 6 def file @file end |
Instance Method Details
#extract! ⇒ Object
15 16 17 18 19 |
# File 'lib/solr_wrapper/tgz_extractor.rb', line 15 def extract! Minitar.unpack(Zlib::GzipReader.open(file), destination) rescue StandardError => e abort "Unable to extract #{file} into #{destination}: #{e.}" end |