An output stream that passes output through stream cleaners. This can be used to strip ANSI color sequences, for instance.
@see IO#<<
# File lib/nanoc/cli/cleaning_stream.rb, line 47 def <<(s) @stream.<<(self.clean(s)) end
Adds a stream cleaner for the given class to this cleaning stream. If the cleaning stream already has the given stream cleaner, nothing happens.
@param [Nanoc::CLI::StreamCleaners::Abstract] klass The class of the
stream cleaner to add
@return [void]
# File lib/nanoc/cli/cleaning_stream.rb, line 21 def add_stream_cleaner(klass) unless @stream_cleaners.map { |c| c.class }.include?(klass) @stream_cleaners << klass.new end end
@see IO#close
# File lib/nanoc/cli/cleaning_stream.rb, line 87 def close @stream.close end
@see File#exist?
# File lib/nanoc/cli/cleaning_stream.rb, line 92 def exist? @stream.exist? end
@see File.exists?
# File lib/nanoc/cli/cleaning_stream.rb, line 97 def exists? @stream.exists? end
@see IO#flush
# File lib/nanoc/cli/cleaning_stream.rb, line 57 def flush @stream.flush end
@see IO#print
# File lib/nanoc/cli/cleaning_stream.rb, line 67 def print(s) @stream.print(self.clean(s)) end
@see IO#puts
# File lib/nanoc/cli/cleaning_stream.rb, line 72 def puts(*s) @stream.puts(*s.map { |ss| self.clean(ss) }) end
Removes the stream cleaner for the given class from this cleaning stream. If the cleaning stream does not have the given stream cleaner, nothing happens.
@param [Nanoc::CLI::StreamCleaners::Abstract] klass The class of the
stream cleaner to add
@return [void]
# File lib/nanoc/cli/cleaning_stream.rb, line 35 def remove_stream_cleaner(klass) @stream_cleaners.delete_if { |c| c.class == klass } end
@see IO#reopen
# File lib/nanoc/cli/cleaning_stream.rb, line 82 def reopen(*a) @stream.reopen(*a) end
@see StringIO#string
# File lib/nanoc/cli/cleaning_stream.rb, line 77 def string @stream.string end
@see IO#tell
# File lib/nanoc/cli/cleaning_stream.rb, line 62 def tell @stream.tell end
@see IO#tty?
# File lib/nanoc/cli/cleaning_stream.rb, line 52 def tty? @cached_is_tty ||= @stream.tty? end
@see IO.winsize
# File lib/nanoc/cli/cleaning_stream.rb, line 102 def winsize @stream.winsize end
Generated with the Darkfish Rdoc Generator 2.