Sha256: e3f0b611c6eb2aeaa6b9287751f2b808cf60dfb241a6096df63b3da9333e5cd5

Contents?: true

Size: 826 Bytes

Versions: 2

Compression:

Stored size: 826 Bytes

Contents

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

module ANSI

  #
  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

2 entries across 2 versions & 1 rubygems

Version Path
ansi-1.0.1 lib/ansi/terminal.rb
ansi-1.0.0 lib/ansi/terminal.rb