<<(str)
click to toggle source
def << str
@buffer << str
self
end
==(other)
click to toggle source
def == other
to_s == other
end
=~(other)
click to toggle source
def =~ other
to_s =~ other
end
flush()
click to toggle source
def flush
@output += @buffer.join('')
@buffer.clear
self
end
method_missing(name, *args, &block)
click to toggle source
def method_missing(name, *args, &block)
to_s.send(name, *args, &block)
end
print(*str)
click to toggle source
def print(*str)
write(str.join + $\.to_s)
end
printf(format, *args)
click to toggle source
def printf(format, *args)
self << sprintf(format, *args)
end
puts(*str)
click to toggle source
def puts(*str)
if str.empty?
write "\n"
else
write(str.collect { |s| s.to_s.chomp }.concat([nil]).join("\n"))
end
end
to_s()
click to toggle source
def to_s
flush
@output
end
to_str()
click to toggle source
write(*str)
click to toggle source
def write(*str)
self << str.join
end