我试图将一个参数传递给一个登录方法,我想基于该参数来切换基本的uri.
像这样:
class Managementdb include HTTParty def self.login(game_name) case game_name when "game1" self.base_uri = "http://game1" when "game2" self.base_uri = "http://game2" when "game3" self.base_uri = "http://game3" end response = self.get("/login") if response.success? @authToken = response["authToken"] else # this just raises the net/http response that was raised raise response.response end end ...
当我从一个方法中称之为基本的uri时,我该怎么办?