Skip to content

Instantly share code, notes, and snippets.

@elight
Created April 10, 2014 22:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elight/10428519 to your computer and use it in GitHub Desktop.
Save elight/10428519 to your computer and use it in GitHub Desktop.
def new(config = {})
if config.respond_to?(:config_service?) && config.config_service?
cleaned_settings = config
else
cleaned_settings = handle_settings(config)
end
setup_requirements
svc = service
if Fog.mocking?
while svc != Fog::Service
service::Real.send(:include, svc::Collections)
svc = svc.superclass
end
service::Mock.new(cleaned_settings)
else
while svc != Fog::Service
service::Real.send(:include, svc::Collections)
svc = svc.superclass
end
service::Real.send(:include, service::NoLeakInspector)
service::Real.new(cleaned_settings)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment