以下行为是错误还是功能?
class A
def initialize(**options)
@options = options
end
def foo(**options)
bar(**@options, **options)
end
def bar(**options)
end
def print
puts @options.inspect
end
end
a = A.new(one: 1)
a.print # {:one=>1}
a.foo(two: 2)
a.print # {:one=>1, :two=>2}
获得使用:
$ ruby -v
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
如果有一个功能,哪里可以读到它?谢谢!
此致 伊万