module Geos::GoogleMaps

Public Class Methods

use_api(version) click to toggle source
# File lib/geos/google_maps.rb, line 7
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