Class: Twitter::Factory
- Inherits:
-
Object
- Object
- Twitter::Factory
- Defined in:
- lib/twitter/factory.rb
Direct Known Subclasses
Class Method Summary collapse
-
.fetch_or_new(method, klass, attrs = {}) ⇒ Twitter::Action::Favorite, ...
Instantiates a new action object.
Class Method Details
.fetch_or_new(method, klass, attrs = {}) ⇒ Twitter::Action::Favorite, ...
Instantiates a new action object
11 12 13 14 15 16 17 18 |
# File 'lib/twitter/factory.rb', line 11 def self.fetch_or_new(method, klass, attrs={}) return unless attrs if type = attrs.delete(method.to_sym) klass.const_get(type.camelize.to_sym).fetch_or_new(attrs) else raise ArgumentError, "argument must have :#{method} key" end end |