Module: PartyParrot::TerminalChecker

Defined in:
lib/party_parrot/terminal_checker.rb

Class Method Summary collapse

Class Method Details

.suitable_for_terminal?(formatter) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/party_parrot/terminal_checker.rb', line 11

def suitable_for_terminal?(formatter)
  terminal_size[:width] > formatter::MINIMAL_TERMINAL_WIDTH
end

.terminal_sizeObject



4
5
6
7
8
9
# File 'lib/party_parrot/terminal_checker.rb', line 4

def terminal_size
  @terminal_size ||= (
    sizes_array = `stty size`.split(' ').map(&:to_i)
    { height: sizes_array.first, width: sizes_array.last }
  )
end