Class: Twitter::GeoFactory

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

Class Method Summary collapse

Class Method Details

.new(geo = {}) ⇒ Twitter::Point, Twitter::Polygon

Instantiates a new geo object

Parameters:

Returns:

Raises:

  • (ArgumentError)

    Error raised when supplied argument is missing a 'type' key.



12
13
14
15
16
17
18
19
# File 'lib/twitter/geo_factory.rb', line 12

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