Module: Yell::Adapters
- Defined in:
- lib/yell/adapters.rb,
lib/yell/adapters/io.rb,
lib/yell/adapters/base.rb,
lib/yell/adapters/file.rb,
lib/yell/adapters/streams.rb,
lib/yell/adapters/datefile.rb
Overview
:nodoc:
Defined Under Namespace
Classes: Base, Collection, Datefile, File, Io, Stderr, Stdout
Class Method Summary collapse
-
.new(type, options = {}, &block) ⇒ Object
Returns an instance of the given processor type.
-
.register(name, klass) ⇒ Object
Register your own adapter here.
Class Method Details
.new(type, options = {}, &block) ⇒ Object
Returns an instance of the given processor type.
61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/yell/adapters.rb', line 61 def self.new( type, = {}, &block ) return type if type.is_a?(Yell::Adapters::Base) adapter = case type when STDOUT then @adapters[:stdout] when STDERR then @adapters[:stderr] else @adapters[type.to_sym] end raise AdapterNotFound.new(type) if adapter.nil? adapter.new(, &block) end |
.register(name, klass) ⇒ Object
Register your own adapter here
53 54 55 |
# File 'lib/yell/adapters.rb', line 53 def self.register( name, klass ) @adapters[name.to_sym] = klass end |