Module: TZDetect::Geocoder

Included in:
GeonameGeocode, GoogleGeocode
Defined in:
lib/tzdetect/geocoder.rb

Defined Under Namespace

Modules: ClassMethods

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cityObject

Returns the value of attribute city.



4
5
6
# File 'lib/tzdetect/geocoder.rb', line 4

def city
  @city
end

#countryObject

Returns the value of attribute country.



4
5
6
# File 'lib/tzdetect/geocoder.rb', line 4

def country
  @country
end

#latitudeObject (readonly)

Returns the value of attribute latitude.



5
6
7
# File 'lib/tzdetect/geocoder.rb', line 5

def latitude
  @latitude
end

#longitudeObject (readonly)

Returns the value of attribute longitude.



5
6
7
# File 'lib/tzdetect/geocoder.rb', line 5

def longitude
  @longitude
end

#regionObject

Returns the value of attribute region.



4
5
6
# File 'lib/tzdetect/geocoder.rb', line 4

def region
  @region
end

#timezoneObject (readonly)

Returns the value of attribute timezone.



5
6
7
# File 'lib/tzdetect/geocoder.rb', line 5

def timezone
  @timezone
end

Class Method Details

.included(base) ⇒ Object



15
16
17
# File 'lib/tzdetect/geocoder.rb', line 15

def self.included(base)
  base.extend(ClassMethods)
end

Instance Method Details

#fetched_dataObject



60
61
62
# File 'lib/tzdetect/geocoder.rb', line 60

def fetched_data
  Position.new(@latitude, @longitude, @timezone)
end

#initialize(country, city, region = "") ⇒ Object

Constructor initalize country city and region



8
9
10
11
12
# File 'lib/tzdetect/geocoder.rb', line 8

def initialize country, city, region=""
  @country = country
  @city    = city
  @region  = region
end

#position!Object

Returns position raise excpetion

Raises:

  • (TZDetect::Error::Geocoder)


56
57
58
# File 'lib/tzdetect/geocoder.rb', line 56

def position!
  raise TZDetect::Error::Geocoder, "not implemented method position!"
end

#postionObject

Returns position



47
48
49
50
51
52
53
# File 'lib/tzdetect/geocoder.rb', line 47

def postion
  begin
    self.postion! 
  rescue 
    nil
  end
end