Flowdock

Notes posted by matthewtuck

RSS feed
August 13, 2014 - (>= v4.0.2)
0 thanks

Non-existent key semantics changed.

For Rails 4.0, the behaviour of this has changed when you pass a key that isn’t in the hash.

3.2 (undocumented):

{ a: 1, b: 2 }.extract!(:a, :x) # => {:a=>1, :x => nil}

4.0 (as per docs):

{ a: 1, b: 2 }.extract!(:a, :x) # => {:a=>1}

The 4.0 behaviour is now consistent with the behaviour of slice, the 3.2 behaviour was not.