| Class | Ym4r::GmPlugin::ApiKey |
| In: |
lib/gm_plugin/key.rb
|
| Parent: | Object |
Class fo the manipulation of the API key
| GMAPS_API_KEY | = | YAML.load_file(RAILS_ROOT + '/config/gmaps_api_key.yml')[ENV['RAILS_ENV']] |
# File lib/gm_plugin/key.rb, line 18
18: def self.get(options = {})
19: if options.has_key?(:key)
20: options[:key]
21: elsif GMAPS_API_KEY.is_a?(Hash)
22: #For this environment, multiple hosts are possible.
23: #:host must have been passed as option
24: if options.has_key?(:host)
25: GMAPS_API_KEY[options[:host]]
26: else
27: raise AmbiguousGMapsAPIKeyException.new(GMAPS_API_KEY.keys.join(","))
28: end
29: else
30: #Only one possible key: take it and ignore the :host option if it is there
31: GMAPS_API_KEY
32: end
33: end