阅读背景:

Ruby在Ruby中创建Hash自定义反转函数

来源:互联网 

Ruby class Hash has method "invert" which make "reversal" between keys and values and delete same keys (in our case its: "1=>:a"). h = {a: 1, b: 2, c: 1} => {:a=>1, :b=>2, :c=>1} h.invert => {1=>:c, 2=>:b}Ruby class Hash has method "invert" which make




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: