Sha256: d27fff2fbbdc9df7bd1232bbb75f51926e7842ce3838a1edbbc65311ca098c13
Contents?: true
Size: 608 Bytes
Versions: 2
Compression:
Stored size: 608 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={}) options = options.dup 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
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
winton-fetcher-0.1.2 | lib/fetcher.rb |
sum-0.1.2 | vendor/fetcher/lib/fetcher.rb |