Since ruby 2.0.0, there is a ‘io/console’ in the stdlib with this feature
require 'io/console'
STDIN.getch
More Related Contents:
- How to convert Time format in ruby
- Regex for reverse match a string
- Why do Ruby setters need “self.” qualification within the class?
- What is the difference between require_relative and require in Ruby?
- Ruby, Difference between exec, system and %x() or Backticks
- Why does Ruby 1.9.2 remove “.” from LOAD_PATH, and what’s the alternative?
- What is the difference or value of these block coding styles in Ruby?
- rvm installation not working: “RVM is not a function”
- How to understand symbols in Ruby
- Ruby array access 2 consecutive(chained) elements at a time
- What does &. (ampersand dot) mean in Ruby?
- How to get argument names using reflection
- How to count duplicate elements in a Ruby array
- What does tilde-greater-than (~>) mean in Ruby gem dependencies? [duplicate]
- ActionController::UnknownFormat
- Create two-dimensional arrays and access sub-arrays in Ruby
- How to merge Ruby hashes
- What does
- Serving static files with Sinatra
- Nokogiri, open-uri, and Unicode Characters
- Double Pipe Symbols in Ruby Variable Assignment? [duplicate]
- How can I clear the terminal in Ruby?
- Ruby ‘require’ error: cannot load such file
- Testing modules in RSpec
- How to check if a directory/file/symlink exists with one command in Ruby
- Split string by multiple delimiters
- RVM and thin, root vs. local user
- Ruby array subtraction without removing items more than once
- Transliteration in ruby
- How to match something with regex that is not between two special characters?