I have few items in my_list
:
@my_list = {
"all": [
"prd02",
"stg01",
"prd01",
"stg02"
],
"prd": [
"prd02",
"prd01"
],
"stg": [
"stg02",
"stg01"
]
}
Currently, I print all of them in all
:
if @my_list['all'].include?(@item)
puts "#{@item}"
My current output is:
prd02
stg01
prd01
stg02
How can I check if that item is present in "prd"
before printing the items? It should append "(prod)" and if that item is in "stg"
it should append "(staging)".
I want to get my desired output as:
prd02 (prod)
stg01 (staging)
prd01 (prod)
stg02 (staging)
How can I check if the item is present in prd or stg?
if @my_list['all'].exists ? @my_list['prod'](@item)
puts "#{@item}.(prod)"