Ruby Objects and Dot Syntax
Read OriginalThis 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.
Comments
No comments yet
Be the first to share your thoughts!
Browser Extension
Get instant access to AllDevBlogs from your browser