Last active
August 29, 2015 14:05
-
-
Save nblackburn87/f58d7c84bc521870e0b4 to your computer and use it in GitHub Desktop.
Array Sorter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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