Sha256: d0d2c5235cc0ea51edb4acfa8c8ed2f64226713a37f3de165d45db02fab4bd44

Contents?: true

Size: 361 Bytes

Versions: 1

Compression:

Stored size: 361 Bytes

Contents

require 'dev/ui'
require 'io/console'

module Dev
  module UI
    module Terminal
      # Returns the width of the terminal, if possible
      # Otherwise will return 80
      #
      def self.width
        if console = IO.console
          console.winsize[1]
        else
          80
        end
      rescue Errno::EIO
        80
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dev-ui-0.1.1 lib/dev/ui/terminal.rb