在我班上我有
@@hashtable = {foo: 10,fooo:20 ...}
我现在可以检查这样的值
@@hashtable[foo]
有没有办法给它起别名,让我自己能够像这样调用它
@@hashtable[foos]
并获取
的值@@hashtable[foo]
答案 0 :(得分:0)
def my_method(options)
'asd' if options[:param1] == :asd
end
def my_other_method(options)
options[:param1] = :asd if options[:param1] == :asds
my_method options
end
my_other_method param1: :asds #=> 'asd'