Class: FTT::Util

Inherits:
Object
  • Object
show all
Defined in:
lib/fancy_terminal_text/util.rb

Class Method Summary collapse

Class Method Details

.term_dimensionsObject



5
6
7
8
# File 'lib/fancy_terminal_text/util.rb', line 5

def self.term_dimensions
  height, width = `stty size`.chomp.split(' ').map(&:to_i)
  OpenStruct.new(width: width, height: height)
end

.term_heightObject



14
15
16
# File 'lib/fancy_terminal_text/util.rb', line 14

def self.term_height
  term_dimensions.height
end

.term_widthObject



10
11
12
# File 'lib/fancy_terminal_text/util.rb', line 10

def self.term_width
  term_dimensions.width
end