device_target = ["3001", "3002", "3003"]
devices = ",kv1101="
device_target.map {|d|
case d
when "30000" #desktop
devices << ":9"
when "30001" # smartphone
devices << ":3:4:6:8"
when "30002" #tablet
devices << ":2:5:7"
when "30003" #feature_phone
devices << ":1"
end
My target is to get devices = "kv1101=3:4:6:8:2:5:7:1"
. But, how can I avoid this colon :
from the first entry? The order doesn't matter.
"9:3:4:6:8:2"
. – Stefan Oct 6 '14 at 13:003001,3002,3003
so 2 things one there is no3000
and 2 your case statement will never work sinced
will never be in30000,30001,30002,30003
– engineersmnky Oct 6 '14 at 13:09