![]() |
|
[Ruby] Database search system - Printable Version +- Sinisterly (https://sinister.li) +-- Forum: Coding (https://sinister.li/Forum-Coding) +--- Forum: Coding (https://sinister.li/Forum-Coding--71) +--- Thread: [Ruby] Database search system (/Thread-Ruby-Database-search-system) |
[Ruby] Database search system - Inori - 04-08-2015 This is more of a concept than a fully-built program but here it is (If you're not in the list, don't be offended.) Code: #rDB by Nightc||ed, ©2015
db = Hash.new
######List definitions######
db["Admin "] = "Oni"
db["Gold "] = "Eclipse"
db["S-Mod "] = "Saikou"
db["Dysfunctional();"] = "Nightc||ed"
db["Registered "] = "Anime"
db["Bronze "] = "Master"
db["Err "] = "Error"
############################
x = 0
num = db.count - 1
###########Full list############
puts "Group: Member:"
num.times do |pair|
puts "#{db.keys[x]} │ #{db.values[x]}"
x += 1
end
###############################
puts "-------------------
Enter index number:"
i = gets.to_i
i -= 1
system "cls"
puts "Group: Member:"
puts "#{db.keys[i]} │ #{db.values[i]}"
sleep |