Method: Twitter::Factory.new
- Defined in:
- lib/twitter/factory.rb
.new(method, klass, attrs = {}) ⇒ Twitter::Base
Constructs a new object based on type
15 16 17 18 19 |
# File 'lib/twitter/factory.rb', line 15 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 |