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(name, options = {}, &block) ⇒ Object
Returns an instance of the given processor type.
-
.register(name, klass) ⇒ Object
Register your own adapter here.
Class Method Details
.new(name, options = {}, &block) ⇒ Object
Returns an instance of the given processor type.
64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/yell/adapters.rb', line 64 def self.new( name, = {}, &block ) return name if name.is_a?(Yell::Adapters::Base) adapter = case name when STDOUT then @adapters[:stdout] when STDERR then @adapters[:stderr] else @adapters[name.to_sym] end raise AdapterNotFound.new(name) if adapter.nil? adapter.new(, &block) end |
.register(name, klass) ⇒ Object
Register your own adapter here
56 57 58 |
# File 'lib/yell/adapters.rb', line 56 def self.register( name, klass ) @adapters[name.to_sym] = klass end |