Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split Google Maps APIs 2 and 3 into separate components.
- Loading branch information
1 parent
a8ce608
commit e42ca2c
Showing
7 changed files
with
400 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,5 @@ | |
require File.join(Geos::GEOS_EXTENSIONS_BASE, %w{ .. rails railtie }) | ||
end | ||
|
||
Geos::GoogleMaps.use_api(2) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,28 @@ | ||
|
||
module Geos | ||
module GoogleMaps | ||
class << self | ||
def use_api(version) | ||
version_const = Geos::GoogleMaps.const_get("Api#{version}") | ||
version_const.constants.each do |c| | ||
mod = version_const.const_get(c) | ||
klass = Geos.const_get(c) | ||
regex = %r{_api#{version}$} | ||
|
||
if !klass.include?(mod) | ||
klass.send(:include, mod) | ||
end | ||
|
||
mod.instance_methods.each do |method| | ||
klass.send(:alias_method, method.to_s.sub(regex, ''), method) | ||
end | ||
end | ||
end | ||
end | ||
|
||
autoload :PolylineEncoder, File.join(GEOS_EXTENSIONS_BASE, *%w{ geos google_maps polyline_encoder }) | ||
autoload :ApiIncluder, File.join(GEOS_EXTENSIONS_BASE, *%w{ geos google_maps api_includer }) | ||
autoload :Api2, File.join(GEOS_EXTENSIONS_BASE, *%w{ geos google_maps api_2 }) | ||
autoload :Api3, File.join(GEOS_EXTENSIONS_BASE, *%w{ geos google_maps api_3 }) | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.