How to add optional keyword to Ruby2.0 keyword argument?

Ruby

I recently have a requirement that need optional keyword in method call like this:

method( admin: 'admin' )
method( admin: 'admin', optional_k: 'external message here' )

It's easy to use

def method(option)
  admin = option.delete(:admin)
  optional = option
end

But it's not safe, and not clean for…

Read More >>

Posted At 2016.06.06

RECENT

WELCOME

I'm Li Yafei, WinDy is my English name.

ABOUT

  • Industry:Web Development, Startups, Life
  • Location:Nan Shan District, ShenZhen, China
  • More:About Me

SUBSCRIBE