How to reverse a string and replace the vowels with their corresponding ASCII decimal value (using Ruby)
For the purpose of this example, the Interactive Ruby Shell (IRB) will be used.
Start the IRB by executing the irb
command from your terminal:
% > irb
Then, execute the following code:
"HERE_GOES_YOUR_STRING".reverse!.gsub!(/[aeiou]/) { |m| m.ord.to_s }
The following output will be returned:
=> "gn105rts r117111y s101111g 101r101h"