File: terminal.rb

package info (click to toggle)
ruby-console 1.34.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 272 kB
  • sloc: ruby: 1,509; makefile: 4
file content (21 lines) | stat: -rw-r--r-- 417 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

# Released under the MIT License.
# Copyright, 2019-2025, by Samuel Williams.

require_relative "terminal/text"
require_relative "terminal/xterm"
require_relative "terminal/formatter"

module Console
	module Terminal
		# Create a new terminal output for the given stream.
		def self.for(stream)
			if stream.tty?
				XTerm.new(stream)
			else
				Text.new(stream)
			end
		end
	end
end