Rob Dodson 5/1/2012

Ruby Objects and Dot Syntax

Read Original

This technical article clarifies a common point of confusion for developers, especially those coming from JavaScript: Ruby's Hash objects do not allow dot syntax (e.g., `person.city`). It explains the correct way to access Hash values and contrasts Hashes with other Ruby objects like Classes (using attr_accessor), Structs, and OpenStructs, which do support dot notation for accessing attributes.

Ruby Objects and Dot Syntax

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser

Top of the Week