How to get the width of terminal window in Ruby

前端 未结 9 1481
你的背包
你的背包 2021-01-30 16:30

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

9条回答
  •  鱼传尺愫
    2021-01-30 17:17

    If you want your code to work across platforms, here's what I use: http://github.com/cldwalker/hirb/blob/master/lib/hirb/util.rb#L61-71

    Also check out the system_extensions file in highline

提交回复
热议问题