Sha256: bee79f3b6e27d5f9a503af339abb2722e77c9e0c4c67ed73eedf059419ed0b33
Contents?: true
Size: 582 Bytes
Versions: 1
Compression:
Stored size: 582 Bytes
Contents
module Fetcher # Use factory-style initialization or insantiate directly from a subclass # # Options: # * <tt>:type</tt> - Name of class as a symbol to instantiate # # Other options are the same as Fetcher::Base.new # # Example: # # Fetcher.create(:type => :pop) is equivalent to # Fetcher::Pop.new() def self.create(options={}) klass = options.delete(:type) raise ArgumentError, 'Must supply a type' unless klass module_eval "#{klass.to_s.capitalize}.new(options)" end end require 'fetcher/base' require 'fetcher/pop' require 'fetcher/imap'
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
winton-fetcher-0.1.1 | lib/fetcher.rb |