class Yell::Adapters::Io

def close!

Overloads:
  • close!
def close!
  @stream.close if @stream.respond_to? :close
  @stream = nil
  super
end

def colorize!; @colors = true; end

colorize!
@example

Shortcut to enable colors.
def colorize!; @colors = true; end

def inspectables

Overloads:
  • inspectables
def inspectables
  super.concat [:formatter, :colors, :sync]
end

def open!

Overloads:
  • open!
def open!
  @stream.sync = self.sync if @stream.respond_to? :sync
  @stream.flush            if @stream.respond_to? :flush
  super
end

def setup!( options )

Overloads:
  • setup!( options )
def setup!( options )
  @stream = nil
  self.colors = options.fetch(:colors, false)
  self.formatter = options.fetch(:format, options[:formatter])
  self.sync = options.fetch(:sync, true)
  super
end

def stream

of this method.
Adapter classes should provide their own implementation

The IO stream
def stream
  synchronize { open! if @stream.nil?; @stream }
end

def write!( event )

Overloads:
  • write!( event )
def write!( event )
  message = formatter.call(event)
  # colorize if applicable
  if colors and color = TTYColors[event.level]
    message = color + message + TTYColors[-1]
  end
  stream.syswrite(message)
  super
end