class FileReader

Reads a Ubuntu Iso manifest file and output the package names

Attributes

manifest_file[R]

Public Class Methods

new(manifest_file) click to toggle source
# File lib/dist_diff/file_reader.rb, line 5
def initialize(manifest_file)
  @manifest_file = manifest_file
end

Public Instance Methods

package_names() click to toggle source
# File lib/dist_diff/file_reader.rb, line 9
def package_names
  file_content = readfile(manifest_file)
  extract_package_names_into_array(file_content)
end

Private Instance Methods

extract_package_names_into_array(file_content) click to toggle source
# File lib/dist_diff/file_reader.rb, line 22
def extract_package_names_into_array(file_content)
  file_content.split(' ').select.with_index { |_, i| i.even? }
end
readfile(filename) click to toggle source
# File lib/dist_diff/file_reader.rb, line 16
def readfile(filename)
  File.open(filename, 'r') do |f|
    f.read
  end
end