0
Follow
0
View

Handling keyword parameters in `method_missing`

qq328170374 注册会员
2023-01-25 22:39

missing works just like any other method in this regard. When you use a double splat it will slurp any keyword arguments and kwargs will always be a hash:

module Foo
  def self.method_missing(*args, **kwargs, &block)
    kwargs
  end
end
irb(main):049:0> Foo.bar(baz: 'Hello World')
=> {:baz=>"Hello World"}    

About the Author

Question Info

Publish Time
2023-01-25 22:39
Update Time
2023-01-25 22:39

Related Question

window.open覆盖了alert

5g paging DCI基站侧下发时机

Sed删除字符串直到Linux中匹配[closed]

weblogic启动设置为windows服务

C语言char类型与int类型之间的转换

用pyinstaller打包python程序script '路径' not found

MongoDB Aggregation Pipeline:条件乘法

Windbg,明明有内存泄露,但是!heap –s,内存不会增长,什么原因?

SQL优化问题,一个变量引发从clustered index seek 变成了clustered index scan

Windows server2025工作域ip.,ping不到