How can I set up the editor so that when I type { I automatically get {} with the cursor between { and }?

ruby
editor

#1

How can I set up the editor so that when I type { I automatically get {} with the cursor between { and } ?