In Ruby Koans, the about_hashes.rb section contains the following code and comment:
def test_changing_hashes hash = { :one => "uno", :two => "dos" } hash[:one] = "eins" expected = { :one => "eins", :two => "dos" } assert_equal true, expected == hash
I can not understand the answer to the bonus question in the comment - I tried to actually make the replacement that they offer, and the result is the same. All I can understand is that it is intended for readability, but I donβt see general programming tips like those that are called elsewhere in this tutorial.
(I know this sounds like something that could already be answered, but I can't dig up anything authoritative.)
ruby
Bruce Sep 23 '11 at 19:13 2011-09-23 19:13
source share