-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuser_controller.rb
51 lines (43 loc) · 1.06 KB
/
user_controller.rb
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
load '/home/habib/Documents/Ruby/user_project/model/user.rb'
require 'io/console'
class UserController
def initalize
#this instruction is empty
end
def add
puts 'Enter your name'
name =gets.chomp
#puts 'Enter your password'
#password=gets.chomp
print "Password: "
password=STDIN.noecho(&:gets).chomp
if (name=='')or(password=='')
puts 'Your name or your password are maybe empty'
add
else
user=User.new(0,name,password)
test=user.insert
if (test==true)
puts "This user is has been added in data "
else
puts "Error when you add a user !!"
end
end
end
def delete
#puts 'Enter a id'
#user=User.new
#user.delete(id)
end
def update
end
def show
user=User.new(nil,nil,nil)
arr=user.show
for a in arr
puts a
end
end
end
u=UserController.new
u.show