Module: Console::Output::Default

Defined in:
lib/console/output/default.rb

Overview

Default output format selection.

Class Method Summary collapse

Class Method Details

.new(stream, env: ENV, **options) ⇒ Object

Create a new output format based on the given stream.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/console/output/default.rb', line 20

def self.new(stream, env: ENV, **options)
	stream ||= $stderr
	
	if stream.tty?
		output = Terminal.new(stream, **options)
	elsif self.mail?(env)
		output = Text.new(stream, **options)
	elsif self.github_actions?(env)
		output = XTerm.new(stream, **options)
	else
		output = Serialized.new(stream, **options)
	end
	
	return output
end