1

Is there a way of getting all the attr_readers declared in a given Module? I know that Module.public_instance_methods returns all the readers plus additional module methods, but I need only the attr_readers that were declared in the Module.

Important point: I don't have an instance, I need to get the attributes straight from a module, something like: ModuleFoo.public_attributes

fabriciofreitag
  • 2,843
  • 22
  • 26
  • I don't have an instance, I need to get the attributes straight from a module, something like: ModuleFoo.public_attributes – fabriciofreitag Jan 28 '16 at 20:35
  • 2
    @Jordan, I think a better duplicate is [this one](https://stackoverflow.com/questions/2487333/fastest-one-liner-way-to-list-attr-accessors-in-ruby). Not only is it earlier, but I think... – Cary Swoveland Jan 28 '16 at 20:38
  • ...@sepp2k gives a better answer (which was referenced at the link you gave). Aside: who says each comment may contain at most one username? – Cary Swoveland Jan 28 '16 at 20:39

0 Answers0