class Insertion_sort
def self.mini_sort(index,array)
i = index
unsorted_array = array
judge = true
while judge
if unsorted_array[i-1] > unsorted_array[i] && i != 0 then
tmp = unsorted_array[i - 1]
unsorted_array[i - 1] = unsorted_array[i]
unsorted_array[i] = tmp
i -= 1
else
judge = false
end
end
return unsorted_array
end

def self.sort(unsorted_array)
i = 1
while i < unsorted_array.size do
unsorted_array = mini_sort(i,unsorted_array)
i += 1
end
sorted_array = unsorted_array
return sorted_array
end
end

test_array = [2,4,45,6,3,677,32,64,453,1,3,56,7,0]
p Insertion_sort::sort(test_array)