Maybe if you use a translation table, this will look a lot more compact:
```rb
a = { 'sent'    => '\Sent',
      'inbox'   => '\Inbox'
    }

puts "table: #{a}"

puts "testing lookup.."

input = ['asdf', 'bgfg', '\Sent']

puts "input: #{input}"

out = input
a.each do |e,k|
  i = out.index k
  out[i] = e if not i.nil?
end

puts "output: #{out}"

```