-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprinter.rb
More file actions
36 lines (31 loc) · 808 Bytes
/
printer.rb
File metadata and controls
36 lines (31 loc) · 808 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
require 'pry'
require_relative './provider'
class Printer
class << self
def greeting
puts 'Input method what you need'
%w(bubble merge selection counting quick shell ).each do |sort_method|
puts "~ \'#{sort_method}\' for #{sort_method} sort"
end
choice
end
def choice
ch = gets.strip.downcase
getlen(ch)
end
def getlen(ch)
puts 'Enter size of array: '
len = gets.strip.to_i
options = {choice: ch, dimension: len}
output(options)
end
def output(options)
system('clear')
work_array = Provider.new(options)
puts "You choose #{options[:choice]} sort"
puts "Unsort array: #{work_array.unsortarr}"
work_array.choose
puts "Sort array: #{work_array.sortarr}"
end
end
end