Module: TZDetect::Geocoder
- Included in:
- GeonameGeocode, GoogleGeocode
- Defined in:
- lib/tzdetect/geocoder.rb
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary collapse
-
#city ⇒ Object
Returns the value of attribute city.
-
#country ⇒ Object
Returns the value of attribute country.
-
#latitude ⇒ Object
readonly
Returns the value of attribute latitude.
-
#longitude ⇒ Object
readonly
Returns the value of attribute longitude.
-
#region ⇒ Object
Returns the value of attribute region.
-
#timezone ⇒ Object
readonly
Returns the value of attribute timezone.
Class Method Summary collapse
Instance Method Summary collapse
- #fetched_data ⇒ Object
-
#initialize(country, city, region = "") ⇒ Object
Constructor initalize country city and region.
-
#position! ⇒ Object
Returns position raise excpetion.
-
#postion ⇒ Object
Returns position.
Instance Attribute Details
#city ⇒ Object
Returns the value of attribute city.
4 5 6 |
# File 'lib/tzdetect/geocoder.rb', line 4 def city @city end |
#country ⇒ Object
Returns the value of attribute country.
4 5 6 |
# File 'lib/tzdetect/geocoder.rb', line 4 def country @country end |
#latitude ⇒ Object (readonly)
Returns the value of attribute latitude.
5 6 7 |
# File 'lib/tzdetect/geocoder.rb', line 5 def latitude @latitude end |
#longitude ⇒ Object (readonly)
Returns the value of attribute longitude.
5 6 7 |
# File 'lib/tzdetect/geocoder.rb', line 5 def longitude @longitude end |
#region ⇒ Object
Returns the value of attribute region.
4 5 6 |
# File 'lib/tzdetect/geocoder.rb', line 4 def region @region end |
#timezone ⇒ Object (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_data ⇒ Object
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
56 57 58 |
# File 'lib/tzdetect/geocoder.rb', line 56 def position! raise TZDetect::Error::Geocoder, "not implemented method position!" end |
#postion ⇒ Object
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 |