Module: TZDetect::Parser

Included in:
GeonameParser, GoogleParser
Defined in:
lib/tzdetect/parser.rb

Defined Under Namespace

Modules: ClassMethods

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#latitudeObject

Returns the value of attribute latitude.



3
4
5
# File 'lib/tzdetect/parser.rb', line 3

def latitude
  @latitude
end

#longitudeObject

Returns the value of attribute longitude.



3
4
5
# File 'lib/tzdetect/parser.rb', line 3

def longitude
  @longitude
end

Class Method Details

.included(base) ⇒ Object



13
14
15
# File 'lib/tzdetect/parser.rb', line 13

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

Instance Method Details

#initialize(lat, lon) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/tzdetect/parser.rb', line 4

def initialize lat, lon
  lat = lat.to_f if lat.kind_of? Integer
  lon = lon.to_f if lon.kind_of? Integer
  valid_latitude_and_longitude lat, lon
  raise TZDetect::Error::Parser, "lat and long must be float" if !lat.kind_of?(Float) || !lon.kind_of?(Float)
  @latitude  = lat
  @longitude = lon
end

#timezoneObject



24
25
26
27
28
29
30
# File 'lib/tzdetect/parser.rb', line 24

def timezone
  begin
    m = self.timezone!
  rescue
    m = nil
  end
end