-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelpers.rb
49 lines (37 loc) · 1.02 KB
/
helpers.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
def add()
name = get_name()
if @json[name]
print_seperator()
puts "#{name} is already added"
return puts "Promo code: " + print_yellow(@json[name]['code'])
end
code = create_prm_code(name)
@json[name] = {
"code": code,
"activated": false
}
print_seperator()
puts "User added! ✔️"
puts "Promo code: " + print_yellow(code)
end
def activate()
name = get_name()
until @json[name] != nil
puts "Looks like the name you entered isn't in registeration list. Make sure spelling is right and that this person is in list"
name = get_name()
end
if @json[name]['activated']
print_seperator()
return puts "User already activated"
end
@json[name]["activated"] = true
end
def get_code()
name = get_name()
until @json[name] != nil
puts "Looks like the name you entered isn't in registeration list. Make sure spelling is right and that this person is in list"
name = get_name()
end
print_seperator()
puts "Promo code: " + print_yellow(@json[name]['code'])
end