我发现用户Hirolau的这段代码:
def sum_to_n?(a, n)
a.combination(2).find{|x, y| x + y == n}
end
a = [1, 2, 3, 4, 5]
sum_to_n?(a, 9) # => [4, 5]
sum_to_n?(a, 11) # => nil
Run Code Online (Sandbox Code Playgroud)
我如何知道何时可以将两个参数发送到预定义的方法,例如find?我不清楚,因为有时它不起作用.这是重新定义的东西吗?
我一直在收到消息,GitHub在我的Gemfile.lock中发现已知的依赖漏洞,这是丝瓜(2.0.3)和Nokogiri(1.7.0.1),但这些宝石是我没有特别要求的依赖(其他宝石确实依赖于它们)在我的Gemfile中,那么,我该怎么办?