Class: Elevation
- Inherits:
-
Object
- Object
- Elevation
- Includes:
- DecomposerHelper
- Defined in:
- lib/turkish_cities/elevation.rb
Constant Summary collapse
- CITY_LIST =
YAML.load_file(file_path)
- MIN_ELEVATION =
3
- MAX_ELEVATION =
1924
Instance Method Summary collapse
Methods included from DecomposerHelper
#check_input_range, #cities_not_found_error, #city_not_found_error, #city_population_not_found_error, #convert_chars, #create_district_list, #create_file_path, #district_not_found_error, #find_by_between, #postcode_not_found_error, #prepare_city_list, #sort_alphabetically, #sort_input_numbers, #subdistrict_not_found_error
Instance Method Details
#find_by_elevation(type, elevation_one, elevation_two = nil) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/turkish_cities/elevation.rb', line 12 def find_by_elevation(type, elevation_one, elevation_two = nil) city_list = CITY_LIST case type when 'below' check_input_range(elevation_one, self.class::MIN_ELEVATION, Float::INFINITY) below_elevation(city_list, elevation_one) when 'above' check_input_range(elevation_one, 0, self.class::MAX_ELEVATION) above_elevation(city_list, elevation_one) when 'between' between_elevation(city_list, elevation_one.to_i, elevation_two.to_i) else unsupported_elevation_type(type) end end |