lib/mootool/controllers/kernel_collection.rb in mootool-0.1.2 vs lib/mootool/controllers/kernel_collection.rb in mootool-0.2
- old
+ new
@@ -1,24 +1,30 @@
# frozen_string_literal: true
module MooTool
- class KernelCollection < ControllerBase
- command 'kc'
- description 'Kernel Collections'
+ module Controllers
+ # Controller for extracting or viewing a KernelCollection (.kc file)
+ class KernelCollection < ControllerBase
+ command 'kc'
+ description 'Kernel Collections'
- def extract(command, output_folder)
- file = MachO.open command.file
- input = File.open(command.file, 'rb')
+ def extract(command, output_folder)
+ file = MachO.open command.file
+ input = File.open(command.file, 'rb')
- file.command(:LC_FILESET_ENTRY).each do |entry|
- output_path = File.join(output_folder, entry.entry_id.to_s)
- puts "Writing to #{output_path}"
- output_file = File.open(output_path, 'wb')
- matching = file.command(:LC_SEGMENT_64).find { |command| command.fileoff == entry.fileoff }
+ file.command(:LC_FILESET_ENTRY).each do |entry|
+ output_path = File.join(output_folder, entry.entry_id.to_s)
+ puts "Writing to #{output_path}"
+ output_file = File.open(output_path, 'wb')
+ # rubocop:disable Naming/VariableNumber
+ # We do not have control of this name as it is part of ruby-macho
+ matching = file.command(:LC_SEGMENT_64).find { |c| c.fileoff == entry.fileoff }
+ # rubocop:enable Naming/VariableNumber
- input.seek(matching.fileoff)
- output_file.write input.read(matching.filesize)
- output_file.close
+ input.seek(matching.fileoff)
+ output_file.write input.read(matching.filesize)
+ output_file.close
+ end
end
end
end
-end
\ No newline at end of file
+end