Sha256: a2a8ef3e7d7463f3ccb817a03fef77ead5d6b03a785aa848f550c53add914545

Contents?: true

Size: 637 Bytes

Versions: 1

Compression:

Stored size: 637 Bytes

Contents

class SmcUtil::FileExtractor
  OUTPUT_FILE_FLAGS = File::CREAT | File::TRUNC | File::WRONLY

  def initialize(file_reader)
    @file_reader = file_reader
  end


  def extract_to(path)
    File.open(File.join(path, 'header.bin'), OUTPUT_FILE_FLAGS) do |file|
      file.write @file_reader.header
    end

    File.open(File.join(path, 'signature.bin'), OUTPUT_FILE_FLAGS) do |file|
      file.write @file_reader.signature
    end

    File.open(File.join(path, 'binary.bin'), OUTPUT_FILE_FLAGS) do |file|
      @file_reader.regions.each do |offset, content|
        file.seek offset
        file.write content
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
smcutil-0.1.1 lib/smcutil/file_extractor.rb