Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8338611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:38:42+00:00 2026-06-09T04:38:42+00:00

In the ruby pickaxe book, there is a line that says attr_accessor is a

  • 0

In the ruby pickaxe book, there is a line that says

attr_accessor is a class method defined in class Module

But isn’t attr_accessor an instance method? Am I missing something here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T04:38:45+00:00Added an answer on June 9, 2026 at 4:38 am

    Yes, all documentation I can find agrees that attr_accessor is an instance method of Module, and I believe it would have to be an instance rather than class method to do what it does.

    My guess is that it’s just a typo. The authors were probably just trying to point out that rather than being part of the language proper, attr_accessor and friends are just methods of the Module class, and they accidentally said "class" rather than "instance".

    Update: In fact, I can’t find your quote in my copy (10th anniversary edition), although it’s print rather than PDF, so I can’t easily search it. The closest thing I can find is:

    Class attribute declarations are not part of the Ruby syntax: they are simply methods defined in class Module that create accessor methods automatically.

    It’s quite possible that the line you quoted was edited out of editions later than yours.

    Update 2: It’s officially a typo. Listed as page 382 in the errata:

    “attr_accessor is a class method defined in class Module and so is available in all module and class definitions.”

    It should be a private instance method–Dave Thomas

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is a code sample from the ruby pickaxe book: Class VowelFinder include Enumerable
Ruby has a select method that takes an array and returns a subarray consisting
I'm learning Ruby (using the Pickaxe book) and I've encountered a little confusion with
I'm pretty new to ruby and I'm currently reading the Pickaxe book to get
Ruby-doc has this description: The ObjectSpace module contains a number of routines that interact
ruby newbie alert! (hey that rhymes :)) I have read the official definition but
Ruby setters—whether created by (c)attr_accessor or manually—seem to be the only methods that need
Ruby's standard popen3 module does not work on Windows. Is there a maintained replacement
Trying to master Ruby (not rails yet). What book would you recommend reading next?
ruby -n is the closest thing I found, but it repeats the whole script.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.