What the **?

Posted on Leave a commentPosted in Ruby

Oops.  I misspoke in my previous post about Ruby keyword arguments.  There actually is a change in Ruby’s method invocation behavior.  Ruby 2.x supports a new ** operator, which can influence the construction of the keyword arguments Hash. Developers coming from a Python background probably already have a notion about what the ** operator is […]

Ruby Keyword Arguments

Posted on Leave a commentPosted in Ruby

Ruby 2.0.0 was released on February 24, meaning that a long-awaited feature has finally arrived: language-supported keyword arguments!  Sure, you could fake keyword arguments in previous versions of Ruby by doing things like:

But, there was an obvious drawback with this approach: the method definitions were completely opaque! Exactly which keyword arguments did this method […]