Method: Zipcoder.state_cities
- Defined in:
- lib/zipcoder.rb
.state_cities(state, **kwargs) ⇒ Object
Returns the cities in a state
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/zipcoder.rb', line 148 def self.state_cities(state, **kwargs) state = state.strip.upcase names_only = kwargs[:names_only] keys = kwargs[:keys] # Filter the returned cities cities = self.cacher.read_state_cities_cache(state) if names_only cities else infos = [] self.cacher.read_state_cities_cache(state).each { |city| infos << self.city_info("#{city}, #{state}", keys: keys) } infos end end |