ConsoleSourceConsoleTerminalText

class Text

Definitions

def print(*arguments)

Print out the given arguments. When the argument is a symbol, look up the style and inject it into the output stream. When the argument is a proc/lambda, call it with self as the argument. When the argument is anything else, write it directly to the output.

Implementation

def print(*arguments)
	arguments.each do |argument|
		case argument
		when Symbol
			@output.write(self[argument])
		when Proc
			argument.call(self)
		else
			@output.write(argument)
		end
	end
end

def print_line(*arguments)

Print out the arguments as per #print, followed by the reset sequence and a newline.

Implementation

def print_line(*arguments)
	print(*arguments)
	@output.puts(self.reset)
end