small medium large xlarge

Generic-user-small
05 Feb 2011, 00:16
Krzysztof Koźmic (1 post)

I’m reading this book simultaneously with the pick-axe book about Ruby 1.9

I find this annoying that all the examples where arguments are passed to methods via implicit hashes use the old Ruby syntax Customer.create(:name => “John Smith”, :age => 42 )

and I don’t think the new, much nicer Ruby 1.9 syntax is even mentioned as a possibility

Customer.create(name: “John Smith”, age: 42)

I do know that the book doesn’t make assumptions about which Ruby version is being used, but I think it would be beneficial to at least mention in few times “hey, you can use this new syntax instead if you’re running 1.9+”

Generic-user-small
05 Feb 2011, 11:49
Mikael Henriksson (1 post)

Good point! I had no idea that was possible but it does look a lot nicer!!

You must be logged in to comment