是否可以在外部循环的方法中调用next:
bot.rb
while Option.daemon_active?(daemon: "bot")
.....
Trade.market_order
....
end
trade.rb
class Trade
def self.market_order
... complex code ...
response = exchange.market_sell
next if response["state"] == false # This fails. This should start new iteration of while in bot.rb
end
end
有一个非常相似的问题,但它似乎不适合我:call next on ruby loop from external method
1条答案
按热度按时间w8ntj3qf1#
是的。您应该使用
throw
和catch
。bot.rb
trade.rb