Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


getc and 1.9/1.8 compatibility #1

eelco opened this Issue · 1 comment

2 participants


Great fork!

Will you still support ruby 1.8 (system default on OS X Mountain Lion)? If so, there is a bug here:

getc’s return type changed between 1.8 and 1.9 (from a Fixnum to a String), so for 1.8 it also needs a call to the method ‘chr’.

By the way, I'm not sure if getc is the best way to read the character. If you enter multiple characters, you’ll get the next one for each call to getc. It’s probably better to use readline or gets so the buffer gets cleared.


Ah...that's right. Thanks for pointing that out. And, yes, I see no reason why this couldn't support ruby 1.8.

My original intention was to get this to work with a single key-press, but that didn't work out as intended. So, changing this to gets would probably be the way to go.

I'll see if I can patch this today. Thanks for the report!

@jwood jwood closed this issue from a commit
@jwood jwood Use gets to get a character from the user.
The intention of get_char was to get a single keystroke.  But, it turns out that
is harder than expected.  Use gets instead of getc here because getc behaves differently
between ruby 1.8 and ruby 1.9.  This change should enable the gem to run on ruby 1.8.

Fixes #1
@jwood jwood closed this in 8b0ec2a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.