Sha256: 7342d0600c517cf7c629ce33eab55048fac3b8665e30b0fb9d6a97436047395d
Contents?: true
Size: 519 Bytes
Versions: 7
Compression:
Stored size: 519 Bytes
Contents
module Twitter class Factory class << self # Construct a new object # # @param method [Symbol] # @param klass [Class] # @param attrs [Hash] # @raise [IndexError] Error raised when supplied argument is missing a key. # @return [Twitter::Base] def new(method, klass, attrs = {}) type = attrs.fetch(method.to_sym) const_name = type.split('_').collect(&:capitalize).join klass.const_get(const_name.to_sym).new(attrs) end end end end
Version data entries
7 entries across 7 versions & 1 rubygems