Have you ever noticed that if you run rake -T in rails the list of rake descriptions are truncated by the width of the terminal window. So there should be a way to get it in Rub
I wrote the tty-screen gem to detect terminal size across different OS systems and Ruby interpreters. It covers many ways of checking the size including Win API on Windows, Java libs on JRuby and Unix utilities.
This is a module which you can include in your class or call directly:
require 'tty-screen'
TTY::Screen.size # => [51, 280]
TTY::Screen.width # => 280
TTY::Screen.height # => 51
For more info see: https://github.com/piotrmurach/tty-screen