Class: Reaver::Walk

Inherits:
Object
  • Object
show all
Defined in:
lib/reaver/walk.rb

Overview

extract, move file if need

Instance Method Summary collapse

Constructor Details

#initialize(filename, dest, keep_name, strip) ⇒ Walk

Returns a new instance of Walk.



9
10
11
12
13
14
15
16
17
# File 'lib/reaver/walk.rb', line 9

def initialize(filename, dest, keep_name, strip)
  @filename = filename
  @dest = dest
  @keep_name = keep_name || false
  @strip = strip
  check_extension
  check_name
  x
end

Instance Method Details

#xObject



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/reaver/walk.rb', line 19

def x
  case @extension
  when %r{^image/(jpeg|png|svg\+xml)} then copy_file
  when %r{^application/zip} then extract_zip
  when %r{^application/(gzip|x-xz)} then extract_gzip
  when %r{^font/ttf} then copy_file
  when %r{^application/(x-elf|x-sh)} then copy_file_with_x
  else
    puts "Filetype #{@extension} not yet supported, skipping..."
  end
end