Class: TTK::Strategies::Extract

Inherits:
Strategy show all
Includes:
Concrete
Defined in:
lib/ttk/strategies/Extract.rb

Overview

I’m deprecated, use Checkout instead.

Instance Attribute Summary

Attributes inherited from Strategy

#status, #symtbl

Instance Method Summary collapse

Methods inherited from Strategy

#abort, #assign, #clean_instance_variables, #display_unexpected_exc, #display_unexpected_synflow_exc, #fail, #initialize, #initialize_flow_factory, #pass, #raise_error, #reject, #run, #running?, #skip, #skip_if_cached, #strategy, #strategy=, #symbols=, #testify, #timeout=, #to_s, #wclass=

Constructor Details

This class inherits a constructor from TTK::Strategies::Strategy

Instance Method Details

#run_implObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/ttk/strategies/Extract.rb', line 17

def run_impl
  if @file.is_a? String
    @file = FileType.guess(@file)
    if @file.is_a? FileType::Directory
      @symtbl[:extract_dir] = @file.path
      skip
    end
    unless @file.is_a? FileType::Extractable
      fail("Bad file type #@file:#{@file.class}, not extractable")
    end
  end
  path = nil
  begin
    path = @file.extract
  rescue FileType::ExtractError => ex
    fail(ex)
  end
  fail("cannot extract #@file returned path is nil") if path.nil?
  @symtbl[:extract_dir] = path
  pass
end