The reason is that the Ruby version is out of date as discussed in the comments.
The code in question works with Ruby 1.9 or higher, but since the 1.9 series has also finished maintenance, I think it would be better to update it to at least 2.0 or higher.(Ideal for using the current latest version of 2.2.3)
As for the version upgrade method, recently the mainstream is to use rbenv (or RVM) to switch to any version.
I will link the official page of rbenv for your reference.
If you search the Internet, you will find a lot of information in Japanese, so please refer to them and proceed as follows.
© 2022 OneMinuteCode. All rights reserved.