SusSourceSusOutputText

class Text

Definitions

def write(*arguments)

Print out the given arguments. When the argument is a symbol, look up the style and inject it into the io 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 io.

Implementation

def write(*arguments)
	arguments.each do |argument|
		case argument
		when Symbol
			@io.write(self[argument])
		when Proc
			argument.call(self)
		else
			if argument.respond_to?(:print)
				argument.print(self)
			else
				@io.write(argument)
			end
		end
	end
end

def puts(*arguments)

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

Implementation

def puts(*arguments)
	write(*arguments)
	@io.puts(self.reset)
end