class CutePrint::TermWidth

@api private

Public Class Methods

make(width) click to toggle source

Given a width, make an appropriate TermWidth object. The object returned has these readers:

  • width [Integer] Return the actual terminal width

  • visible [Object] Return the terminal width that #Configuration#term_width should return.

@param width [Object] Either the static terminal width,

or :detect to automatically detect the terminal width.

@return [#width, visible]

# File lib/cute_print/term_width.rb, line 17
def self.make(width)
  case width
  when Integer
    Static.new(width)
  when :detect
    Detected.new
  else
    raise ArgumentError, "Invalid terminal width: #{width.inspect}"
  end
end