Class: SimpleGeolocation::Geoworkers::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_geolocation/geoworkers/base.rb

Direct Known Subclasses

Geokit, Geozip

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(geocoder) ⇒ Base

Returns a new instance of Base.



8
9
10
# File 'lib/simple_geolocation/geoworkers/base.rb', line 8

def initialize(geocoder)
  @geocoder = geocoder
end

Instance Attribute Details

#geocoderObject (readonly)

Returns the value of attribute geocoder.



5
6
7
# File 'lib/simple_geolocation/geoworkers/base.rb', line 5

def geocoder
  @geocoder
end

#locationObject (readonly)

Returns the value of attribute location.



5
6
7
# File 'lib/simple_geolocation/geoworkers/base.rb', line 5

def location
  @location
end

#successObject (readonly) Also known as: success?

Returns the value of attribute success.



5
6
7
# File 'lib/simple_geolocation/geoworkers/base.rb', line 5

def success
  @success
end

Class Method Details

.instantiate_geoworker_based_on(geocoder) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/simple_geolocation/geoworkers/base.rb', line 16

def self.instantiate_geoworker_based_on(geocoder)
  if geocoder.zip?
    Geozip.new(geocoder)
  else
    Geokit.new(geocoder)
  end
end

Instance Method Details

#process!Object

Raises:

  • (NotImplementedError)


12
13
14
# File 'lib/simple_geolocation/geoworkers/base.rb', line 12

def process!
  raise NotImplementedError
end