Javascript-style object-value assignment in Ruby

While I was working in Javascript extensively for a project, one of the things I really liked about it was how you could use the dot notation to access members of an object, just as you would call methods. After that, I would often find myself in an IRB shell, absent-mindedly trying to do the same thing with a Ruby Hash, only to be thrown a NoMethodError. The first reaction might be: “Ah, if only Ruby had this feature like Javascript does.”, but of course, it can!

Continue Reading »