Class: GoogleMapsPlatform::Server
- Inherits:
-
Object
- Object
- GoogleMapsPlatform::Server
- Defined in:
- lib/google_maps_platform/configuration.rb
Overview
An enum for API servers.
Constant Summary collapse
- SERVER =
[ GOOGLE_APIS = 'Google APIs'.freeze, MAPS_APIS = 'Maps APIs'.freeze, ROADS_APIS = 'Roads APIs'.freeze ].freeze
Class Method Summary collapse
-
.from_value(value, default_value = GOOGLE_APIS) ⇒ Object
Converts a string or symbol into a valid Server constant.
Class Method Details
.from_value(value, default_value = GOOGLE_APIS) ⇒ Object
Converts a string or symbol into a valid Server constant.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/google_maps_platform/configuration.rb', line 30 def self.from_value(value, default_value = GOOGLE_APIS) return default_value if value.nil? str = value.to_s.strip.downcase case str when 'google_apis' then GOOGLE_APIS when 'maps_apis' then MAPS_APIS when 'roads_apis' then ROADS_APIS else warn "[Server] Unknown server '#{value}', falling back to #{default_value} " default_value end end |