Class: Twitter::Factory
- Inherits:
-
Object
- Object
- Twitter::Factory
- Defined in:
- lib/twitter/factory.rb
Direct Known Subclasses
Class Method Summary collapse
-
.new(method, klass, attrs = {}) ⇒ Twitter::Base
Construct a new object.
Class Method Details
.new(method, klass, attrs = {}) ⇒ Twitter::Base
Construct a new object
11 12 13 14 15 |
# File 'lib/twitter/factory.rb', line 11 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 |