Skip to content

Instantly share code, notes, and snippets.

@nblackburn87
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nblackburn87/f58d7c84bc521870e0b4 to your computer and use it in GitHub Desktop.
Save nblackburn87/f58d7c84bc521870e0b4 to your computer and use it in GitHub Desktop.
Array Sorter
class List
def initialize(array_one, array_two)
@array_one = array_one
@array_two = array_two
end
def array_sort
final_array = []
final_array << (@array_one - @array_two)
final_array.flatten!
end
end
require './lib/array.rb'
def check_array
puts "List your first array (comma separated)."
array_one = gets.chomp.split(',').map(&:to_i)
puts "List your second array (comma separated)."
array_two = gets.chomp.split(',').map(&:to_i)
final_array = List.new(array_one, array_two)
puts "Only #{final_array.array_sort} are exclusive to your first array."
end
check_array
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment