0.0
No commit activity in last 3 years
No release in over 3 years
A tiny gem to accomplish a simple task: Determining the terminal size. == Usage p Terminal.size # ⇒ {height: 90, width: 161} p Terminal.size! # to get 80×25 as a fallback instead of nil
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies
 Project Readme

Terminal.size¶ ↑

A tiny gem to accomplish a simple task: Determining the terminal size.

Usage¶ ↑

p Terminal.size # ⇒ {height: 90, width: 161}
p Terminal.size! # to get 80×25 as a fallback instead of nil

Bonus Contract¶ ↑

One of the guarantees of this project is that it will always be exactly one file: ‘lib/terminal-size/terminal.rb`

So, if you want to come up with some automated way to slurp that into your codebase, it shouldn’t break (and this would be better than a not-easily-updated Copy & Paste). I’m kicking around the idea of using this as an example of an automatic, namespaced fat-pack trick, but we’ll see if that’s really necessary.

Installation¶ ↑

Add this line to your application’s Gemfile:

gem 'terminal-size'

And then execute:

$ bundle

Or install it yourself as:

$ gem install terminal-size