Class: CityTimeZone::Lookup

Inherits:
Object
  • Object
show all
Defined in:
lib/city_time_zone/lookup.rb

Class Method Summary collapse

Class Method Details

.find(name) ⇒ Object



5
6
7
8
9
10
# File 'lib/city_time_zone/lookup.rb', line 5

def self.find(name)
  sql = "SELECT timezone FROM cities WHERE name = ?"
  result = CityTimeZone::Database.new.execute sql, name
  return unless result.count == 1
  result.first.first
end