Class: Twitter::ActionFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/twitter/action_factory.rb

Class Method Summary collapse

Class Method Details

.new(action = {}) ⇒ Twitter::Favorite, ...

Instantiates a new action object

Parameters:

Returns:

Raises:

  • (ArgumentError)

    Error raised when supplied argument is missing an 'action' key.



18
19
20
21
22
23
24
25
# File 'lib/twitter/action_factory.rb', line 18

def self.new(action={})
  type = action.delete('action')
  if type
    Twitter.const_get(type.camelize.to_sym).new(action)
  else
    raise ArgumentError, "argument must have an 'action' key"
  end
end