Sha256: f95045ba3adfd2de0c30e9878d79b72d857cc3197c8d8b07e14cb0a3cf414fa7

Contents?: true

Size: 832 Bytes

Versions: 1

Compression:

Stored size: 832 Bytes

Contents

module ANSI

  # = Terminal
  #
  # This library is based of HighLine's SystemExtensions
  # by James Edward Gray II.
  #
  #   Copyright 2006 Gray Productions.
  #
  # This is Free Software. See LICENSE and COPYING for details.
  #
  module Terminal

    module_function

    modes = %w{win32 termios curses stty}

    #
    # This section builds character reading and terminal size functions
    # to suit the proper platform we're running on.  Be warned:  Here be
    # dragons!
    #
    begin
      require 'ansi/terminal/' + (mode = modes.pop)
      CHARACTER_MODE = mode
    rescue LoadError
      retry
    end

    # Get the width of the terminal window.
    def terminal_width
      terminal_size[0]
    end

    # Get the height of the terminal window.
    def terminal_height
      terminal_size[1]
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ansi-1.1.0 lib/ansi/terminal.rb