ConsoleSourceConsoleOutputDefault

module Default

Default output format selection.

Definitions

def self.new(stream, **options)

Create a new output format based on the given stream.

Signature

parameter io IO

The output stream.

parameter options Hash

Additional options to customize the output.

returns Console::Output::Terminal | Console::Output::Serialized

The output instance, depending on whether the io is a terminal or not.

Implementation

def self.new(stream, **options)
	stream ||= $stderr
	
	if stream.tty?
		output = Terminal.new(stream, **options)
	else
		output = Serialized.new(stream, **options)
	end
	
	return output
end